cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
misc
Helper V
Helper V

Email multiple attachments from multiple records in one email

I have a Sharepoint List which is populated by a Form. This list has a flow run every two weeks which creates an export of the items on the list, emails that export to a supplier, and then archives the records. I have recently been asked to allow users to attach a file to their submission which I have done absolutely fine, but I can't figure out how to get the attachments from every record and attach them to the same export email.

 

I have come across multiple blogs such as this one which tell me how to email multiple attachments from ONE record when that record is first created, but I would like the flow to look at EACH record in a list, take their attachments, and send them in one email at the end of the flow. Is this possible?

1 ACCEPTED SOLUTION

Accepted Solutions
v-LilyW-msft
Community Support
Community Support

Hi @misc 

Sorry for my misunderstanding.

If you want to add another file as an attachment to the email, you can also append this file to the variable.

vLilyWmsft_1-1629709965902.png
vLilyWmsft_0-1629709904850.png

After Flow runs, I will receive an email as below:

vLilyWmsft_2-1629710226671.png

Best Regards.

 

View solution in original post

7 REPLIES 7
leyburn19
Memorable Member
Memorable Member

You should be able to use the append to array variable in that example.  It will continue to add the attachments as you move through the list and then simply put that in your email attachments.  May end up too big though depending on your email and ISP settings for attachments.  I would look at:

 

1. Add a numeric column to your list with a default of of 1

2. Initialize and Array variable

3. At the end of your flow do a get items to find all records with 1

4. Loop through the result.

a. Get Attachments (loop one)

b. Get Attachment content (loop to get attachments)

c. In this loop add the append to array variable as per the document you linked to

5. Back in loop 4 do an update item and set the column to anything but 1

 

When you send your email your attachment array should have all the atts,  but not restriction on size if applicable.

attachment array.png

This was my attempt at the Attachment Array as per the link and other blogs online, but when I came to attach the array to the email it didn't give me the dynamic content I needed. Perhaps you can see where I went wrong?

 

In any case, I'm going to try again with your suggestion above and see how that goes. Watch this space. 

attempt 2 array.png

Ah, so I figured out why I couldn't find the correct dynamic content - I needed to hit the icon on the attachment section  but (I think) because I already have my other attachment there it's giving me the above error. Am I missing some part of the syntax to have my new AttachmentArray and the original attachment too?

v-LilyW-msft
Community Support
Community Support

Hi @misc 

Has your problem been solved?

Please delete the content framed in the image below, keep only variable name(AttachmentArray) and try again. 

vLilyWmsft_0-1629697634233.png

Like this:

vLilyWmsft_1-1629697782779.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

 

So you are correct in a way, the AttachmentArray works fine if I have it on its own. My problem is that I want to send in one email the attachments from the list (gathered together in the AttachmentArray) but also an export of the relevant list items too (which is created by "Get Items > Add a row to excel table into a template" as part of the same flow). That's the additional code which you have circled above.

 

At the moment, I have settled on sending two emails, one with the main export of the list and another with the AttachmentArray but my preference is both together, though nothing I tried seemed to work. 

v-LilyW-msft
Community Support
Community Support

Hi @misc 

Sorry for my misunderstanding.

If you want to add another file as an attachment to the email, you can also append this file to the variable.

vLilyWmsft_1-1629709965902.png
vLilyWmsft_0-1629709904850.png

After Flow runs, I will receive an email as below:

vLilyWmsft_2-1629710226671.png

Best Regards.

 

View solution in original post

Thank you - both this and @leyburn19's answer helped solve my problems! Much appreciated 🙂

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,042)