cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jgutierrez
Regular Visitor

Flow creating one extra email attachment

Hi,

 

I am trying to create a simple flow that, when I receive a specific automatic email, it will grab the attached image form this automatic email. Then, a new email is sent, and the email includes the attachment I mentioned.

 

However, the problem I have is that even though the automatic email only has one attachment, flow is creating another one called 'screenshotpng'. Due to the 'apply for each attachment' logic, it is then sending two emails instead of one: one email with the original attachment, and another with the 'screenshotpng' attachment. Does anyone know why this might be the case? Can I prevent this 'duplicate' or at least filter it out?

 

atch.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @jgutierrez,

 

That is because Attachments within Email is an Array.

Microsoft Flow would take action with each of the elements within the Attachment.

 

To workaround this, we could add a condition within the Apply to each, to filter the needed image out and then send it with another Email.

18.PNG

 

Further, if the attachments only contains those two image, and the position is never change, then we could take use of expression to get the proper attachment:

For example, if the image you wanted is always the first element, then we could take use of the expression below:

 

first(triggerBody()?['Attachments'])

 

For more function reference, please check:

WorkFlow Definition Language schema for Azure Logic Apps

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @jgutierrez,

 

That is because Attachments within Email is an Array.

Microsoft Flow would take action with each of the elements within the Attachment.

 

To workaround this, we could add a condition within the Apply to each, to filter the needed image out and then send it with another Email.

18.PNG

 

Further, if the attachments only contains those two image, and the position is never change, then we could take use of expression to get the proper attachment:

For example, if the image you wanted is always the first element, then we could take use of the expression below:

 

first(triggerBody()?['Attachments'])

 

For more function reference, please check:

WorkFlow Definition Language schema for Azure Logic Apps

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @v-micsh-msft,

 

Thanks for your help, I solved it something similar: array(last(triggerBody()?['Attachments'])) 

Strange that even though there is only one attachment, somehow an empty one is created resulting in teh array. Is this on purpose or a bug?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Users online (1,938)