cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
midland192
Frequent Visitor

Attach Attachment without Appy to each

Hi

 

I'm using a 'Get Mails V3' to retrive items from a mailbox.  The filters I'm using will always ensure that only a single mail is returned.

When I have the results I'm sending an email and adding the single attachment I retrieved from 'Get Mails' action.

 

However PowerAutomate always wants to add 'Apply to each' when I add the attachment into my email which I'm trying to avoid to make my flow a bit cleaner.  I know this is by design because it expects multiple attachments but my filters always ensure only one file will be returned

 

Is there anyway round this? I'd prefer to add the attachment using a variable or some expression

 

thanks

Paul

1 ACCEPTED SOLUTION

Accepted Solutions
mahoneypat
Solution Sage
Solution Sage

You can use this expression instead of the dynamic expression for your file content.  It gets the file content for first record of the table of attachments.

 

triggerOutputs()?['body/attachments'][0]?['contentBytes']

 

You can use this to get the attachment name.

 

triggerOutputs()?['body/attachments'][0]?['name']

 

Regards,

Pat

 

 

View solution in original post

2 REPLIES 2
mahoneypat
Solution Sage
Solution Sage

You can use this expression instead of the dynamic expression for your file content.  It gets the file content for first record of the table of attachments.

 

triggerOutputs()?['body/attachments'][0]?['contentBytes']

 

You can use this to get the attachment name.

 

triggerOutputs()?['body/attachments'][0]?['name']

 

Regards,

Pat

 

 

View solution in original post

midland192
Frequent Visitor

Hi Pat

 

That works

If I had a few 'Get Mails V3' actions with different names how could I reference the name in the expression you sent me?

 

Paul

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Top Kudoed Authors
Users online (976)