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

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
Highlighted
Super User III
Super User III

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!

Learn more from my blog

View solution in original post

9 REPLIES 9
Highlighted
Super User II
Super User II

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!

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

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

Highlighted
Helper II
Helper II

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.

Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

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. 

Highlighted
Super User III
Super User III

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!

Learn more from my blog

View solution in original post

Highlighted
Helper II
Helper II

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
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,618)