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

Send all files as attachment by email from a Share Point Document Library Folder

Greetings

 

Have been trying this for a time now. 

 

I need to tell flows to get all the files in my selected SharePoint Library folder and add them as attachments to an email.

I tried Get File Items and it works but it would sent an email for each file withing the selected SharePoint Library folder. I need to send just one email with all the files as attachments found in the selected SharePoint Library Folder.

 

Any help would be greatly appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
v-yuazh-msft
Community Support
Community Support

Hi @jaysomrivera,

 

I have made a test on my side, please refer to screenshot below to create the flow:

Capture.PNG

 

Capture.PNG

 

The expression in the Condition as below:

@equals(items('Apply_to_each')?['{IsFolder}'], false)

The expression of ContentBytes as below:

body('Get_file_content')?['$Content']

The flow would run successfully as below:

Capture.PNG

 

The email would be sent with attachment as below:

Capture.PNG

You could also refer to link below to learn send an email with multiple attachments:

https://preview.flow.microsoft.com/en-us/blog/multiple-attachments-single-email/

 

Best regards,

Alice

View solution in original post

9 REPLIES 9
v-yuazh-msft
Community Support
Community Support

Hi @jaysomrivera,

 

I have made a test on my side, please refer to screenshot below to create the flow:

Capture.PNG

 

Capture.PNG

 

The expression in the Condition as below:

@equals(items('Apply_to_each')?['{IsFolder}'], false)

The expression of ContentBytes as below:

body('Get_file_content')?['$Content']

The flow would run successfully as below:

Capture.PNG

 

The email would be sent with attachment as below:

Capture.PNG

You could also refer to link below to learn send an email with multiple attachments:

https://preview.flow.microsoft.com/en-us/blog/multiple-attachments-single-email/

 

Best regards,

Alice

View solution in original post

Hi, 

When I try to replicate this, I receive the error:

InvalidTemplate. Unable to process template language expressions in action 'Append_to_array_variable' inputs at line '1' and column '2015': 'The template language expression 'body('Get_file_content')?['$Content']' cannot be evaluated because property '$Content' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.

Is there any solution for this?

Best regards,

Ludwig

 Hi!

here it is the solution!

You have to modify 

body('Get_file_content')?['$Content']

to this:

"ContentBytes": "@{base64(body('Get_file_content'))}"
It is important to put body('Get_file_content') into base64 function.
2019-11-28_16-52-22.pngKépkivágás.PNG
 

 

Anonymous
Not applicable

Hi @v-yuazh-msft .

Thank you you very much for you solution, my flow someway is very similar to this one here but I followed all the steps and I just keep getting one email per attachment, is very confusing for me because I'm not getting any error running the flow. Very appreciatte if someone could help me with this

 

..

 

For me, its not working for attachments which are pdf files. I get the error 

susilacherla12_0-1607622480200.png

 

I rewrote the flow and with below it worked 

 

susilacherla12_0-1607693423744.png

 

Hi this looks like a great option, I managed to recreate the flow and it works sending the email with the attachcments (PDF files) but for some reason when i try to open the files it gives me an error message that it cannot open the file "because it is either not a supported file type or because the file has been damaged"

any thoughts on how to solve this please?

 

thank you

Yes, I faced a similar issue when I began.  Can you share your flow and I will compare with mine. You can hide the sensitive and confidential data

Thank you for getting back to me!

For some reason beyond my understanding (i am super new to this) i write it again and it worked! i must have missed something before.

I did another flow similar to it, but to send me the links instead of the files, and it also works, the problem is that it is sending all the links together (separated by comma) and i would like to have them all in separate rows and not a clue how to do that. Any thoughts

Screenshot - Link flow.png

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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.

Users online (2,331)