cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jaysomrivera
Level: Powered On

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
Community Support Team
Community Support Team

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

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

3 REPLIES 3
Community Support Team
Community Support Team

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

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

lreinhard7
Level 8

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

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

Nango
Level: Powered On

Solution

 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
 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,012)