cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

Hi,

 

I am running a flow which attaches multiple attachments to an email, 2 attachments in this case from a folder in One Drive. The issue I am having is that the flow is duplicating the attachments and attaching around 40 - 60 attachments when there is only supposed to be 2 attachments.

 

See my flow below.

 

Any suggestions to resolve this?

 

Regards,

Mike

 

1.png

 

2.png

 

 

6 REPLIES 6
Highlighted
Super User
Super User

Re: Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

The issue is likely your nested for each loops. I'd recommend adding the conditions outside of the loop. 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Helper I
Helper I

Re: Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

Hi @Brad_Groux 

 

Thanks for the reply.

 

Unfortunately when doing a flow like this pulling the files from OneDrive the flow does not work unless the loops are nested. For example when drawing files from SharePoint what you have suggested will work but not for OneDrive.

 

Any other suggestions to try?

Highlighted
Community Support
Community Support

Re: Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

Hi @Mike1005,

 

Please add a Compose action with length() function to check the array length before Send an Email action. If the length of the array is 40-60, but the email just contains 2 attachments, it is some error with send email action, or it is the issue of your Flow structure.

Annotation 2020-01-14 153450.png

 

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

Highlighted
Helper I
Helper I

Re: Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

Hi @v-litu-msft 

 

Thanks for the reply.

 

Unfortunately the recommendation also does not work. I have also tried as many different combinations in my flow trying to incorporate this with no luck.

 

Regards

Mike

Highlighted
Community Support
Community Support

Re: Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

Hi @Mike1005,

 

So, what's the result of the length of the attachment array?

 

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

Highlighted
Helper I
Helper I

Re: Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

@v-litu-msft 

 

The following message:

 

"The inputs of workflow run action 'Compose' of type 'Compose' are not valid. The variable 'Attachments' must be initialized before it can be used inside action 'Compose'."

 

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (5,504)