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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow to match and grou...
Power Automate
Answered

Flow to match and group files in a SP library and then send to listed email

(0) ShareShare
ReportReport
Posted on by 4

Hello,

I have been having the hardest time with this flow. I am looking to make a button start flow that looks in a share point library with a bunch files.

 

each file has a listed email address. I would like the flow to grab all files for each listed email, group them and attach them into the listed email  and send.

 

im able to make flows that are grabbing all attachments and sending them to every listed email. Instead of sending each set of attachments to the specific email.

 

thank you so much everyone! I have searched so much and not able to figure this out.

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @PA-Jimmy ,

     

    I made a sample for you.

     

    There are the following files in the library, and there is a column of text that is the email address to which the file is sent.

    vxiaochenmsft_0-1669712777335.png

     

     

    Create a flow, and I will explain it step by step.

    vxiaochenmsft_1-1669712777337.png

     

     

    Gets the properties of the files in the library.

    vxiaochenmsft_2-1669712777346.png

     

     

    Select column ‘email address’ data.

    vxiaochenmsft_3-1669712777347.png

     

     

    Create an array and save only one email address for the same email address.

    union(body(‘Select’),body(‘Select’))

    vxiaochenmsft_4-1669712777348.png

     

     

    Create an empty array.

    vxiaochenmsft_5-1669712777348.png

     

     

    Add 'Apply to each' to get the properties of the files in the library and filter the same data as the current email address.

    Items(‘Apply to each’)?[‘Email’]

    vxiaochenmsft_6-1669712777353.png

     

     

    Based on the results of the ‘Filter array’, create another 'Apply to each'. Get the file contents based on the path.

    items('Apply_to_each_2')['{FullPath}']

    vxiaochenmsft_7-1669712777354.png

     

     

    Append the following to the empty array.

    {"Name": items('Apply_to_each_2')['{FilenameWithExtension}'],

    "ContentBytes": body('Get_file_content_using_path')}

    vxiaochenmsft_8-1669712777355.png

     

     

    Send email with array 'varFile' attached. Finally, set the array to empty.

    Items(‘Apply_to_each’)?[‘Email’]

    vxiaochenmsft_9-1669712777358.png

     

     

    Save flow and run it.

    vxiaochenmsft_10-1669712777359.png

     

    Best Regards,

    Wearsky

  • PA-Jimmy Profile Picture
    4 on at

    Wow, thanks! It works perfectly. I just had a question about making it quicker. I tried to open up the concurrency settings in the 2 apply to each loops and it isn't working as well. 

     

    Will this be able to process around 1k pdf files with emails, quickly? 

     

    Thanks again for all the help, your solution helped me from going crazy!

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard