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

Attaching All files in a folder to an email based on a forms response

Hello,

 

I have no real flow to show because i cannot get anything to function the way I need and I am very lost.

I am using a Microsoft Form as a trigger. The user of the form is selecting a person off a list on the form. When they submit the form there are a bunch of steps in between such as approvals but what I cannot figure out is in the end part of the Flow. I need it to take all the contents of a specific folder (based on the person they selected on the form) that is stored on a sharepoint and attach them to an email. The folder is a subfolder so it has to be the ability to filter by path (folder name would be the same as the form selection). The files also will have different file names every time (although we could add something into the file names if that helps.)

 

Is there anyone who can help me get the files from this folder dependent on a form selection and then attach them to an email?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Attaching All files in a folder to an email based on a forms response

Hi @GeigerCDill 

 

Thank you for the discussion earlier.

 

I have built a flow solution for you. This solution explains reading a one particular directory from SharePoint, Get all the file contents and send an email as attachment.

 

Please follow below steps.

 

gb1.png

gb2.png

Above  add the false as expression

gb3.png

Above expression is as follows:

body('Get_file_content_using_path').$content

 

Finally add the send email outside the loop.

 

gb4.png

 

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



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



View solution in original post

9 REPLIES 9
fchopo
Level: Powered On

Re: Attaching All files in a folder to an email based on a forms response

Hello,

You can get all the files in a SharePoint Folder like this: 

2019-10-11 16_34_19-Create your flow _ Microsoft Flow.png

Where test/samplefiles/ should be the folder your user selected in forms.

The problem is with the attach section in outlook, since the number of attachments is unknown and could be different everytime. One possible solution should be to iterate through all the files, get a link to them, store those links in a string variable, and the put this string variable in the email.

Hope it helps!

Highlighted
Super User
Super User

Re: Attaching All files in a folder to an email based on a forms response

Hi @GeigerCDill 

 

Please follow my blog  about how to attach all files in an email.

 

https://mydevexperience.wordpress.com/2019/09/08/microsoft-flow-onedrive-send-all-files-as-attachmen...

 

There are different ways you can retrieve the files from SharePoint. Have a look at Flow SharePoint actions such as List folder, Get File Properties etc. 

 

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



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



GeigerCDill
Level: Powered On

Re: Attaching All files in a folder to an email based on a forms response

Hello,

 

@abm  The problem is I am a super beginner and I do not really know what the functions of List Folder do or how sharepoint lists work in general.

I started to sort of use what you have there but how do I get the content of the files to put in the append to array variable?

This is where I am atCapture.JPG

GeigerCDill
Level: Powered On

Re: Attaching All files in a folder to an email based on a forms response

@fchopo  Unfortuantely i cannot just provide links. The final documents are invoices going out to customers in which we would like to provide them attached to the emails.

Super User
Super User

Re: Attaching All files in a folder to an email based on a forms response

Hi @GeigerCDill 

 

You are in the right direction here except some minor changes. You need to read the folder of the files from SharePoint. Construct in a loop and get th file content into your array. This way you will have all the file contents. Finally you can use the array to attach the files.

 

If you need any further help please let me know.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Super User
Super User

Re: Attaching All files in a folder to an email based on a forms response

Hi @GeigerCDill 

 

If you want a screenshare then happy to help you as well.

 

Thanks a lot

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



GeigerCDill
Level: Powered On

Re: Attaching All files in a folder to an email based on a forms response

@abm what is the method of screen sharing? As it is my work computer I may need to get prior approval. 

Super User
Super User

Re: Attaching All files in a folder to an email based on a forms response

Hi @GeigerCDill 

 

Thank you for the discussion earlier.

 

I have built a flow solution for you. This solution explains reading a one particular directory from SharePoint, Get all the file contents and send an email as attachment.

 

Please follow below steps.

 

gb1.png

gb2.png

Above  add the false as expression

gb3.png

Above expression is as follows:

body('Get_file_content_using_path').$content

 

Finally add the send email outside the loop.

 

gb4.png

 

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



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



View solution in original post

GeigerCDill
Level: Powered On

Re: Attaching All files in a folder to an email based on a forms response

This solution worked perfectly for a single folder and then beyond that we discussed privately how you can use dynamic content within the paths to help it pick up paths depending on a selection on a form. As well as if you have spaces in your files path, you may need to insert that path into a URI component.

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 (6,188)