web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Attaching All files in...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on by

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?

Categories:
I have the same question (0)
  • fchopo Profile Picture
    8,003 Moderator on at

    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!

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    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-attachment-by-email/

     

    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

  • Community Power Platform Member Profile Picture
    on at

    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

  • Community Power Platform Member Profile Picture
    on at

    @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.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    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

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

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

     

    Thanks a lot

     

  • Community Power Platform Member Profile Picture
    on at

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

  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    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

  • Community Power Platform Member Profile Picture
    on at

    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.

  • Community Power Platform Member Profile Picture
    on at

    @abm , may I ask for your advise for this case when the last action is "Start and wait for an approval" instead of "Send an Email".

    What should be adjusted in the Append to array?

    I have been keep trying but still cannot find a solution.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard