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 / Extracting Email attac...
Power Automate
Unanswered

Extracting Email attachments when Subject contains specific Value.

(0) ShareShare
ReportReport
Posted on by 5

FBKB_0-1679470710269.png

The outcome of the condition is always false. 

 

Essentially this is a Microsoft form that all the outcomes of the form go to a excel table. the form number is used to communicate across business suppliers, and is always within the subject of an email chain for one department of the company. 

i am trying to extract attachments from emails containing the specific form number and place them into a folder that is named the form number. (This already works - i have a folder automatic creation working). 

 

Help Please?

Categories:
I have the same question (0)
  • FBKB Profile Picture
    5 on at

    Anyone?

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    How many rows do you currently have in your Excel Table? List rows present in a table will only return up to 256 rows by default. If you have more than 256 rows, you would need to change it to allow more. I've rebuilt the flow how I would achieve this, so it avoids the looping and condition within each iteration.

     

    For this example, I'm using the following Excel Table. It just contains a list of Form numbers.

    grantjenkins_0-1679529443582.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1679529479462.png

     

    When a new email arrives would be setup as below. This would be your Shared mailbox trigger.

    grantjenkins_2-1679533640384.png

     

    List rows present in a table would retrieve the Excel Table data. If you have more than 256 rows, then you can set the Top Count to a max of 5000 so it will return up to 5000 items. If you had more than 5000 items, then let me know and we can add Pagination and a Threshold to get more if required.

    grantjenkins_3-1679533755234.png

     

    Filter array will filter out the data, so it only returns items where the Subject contains the Form Number. If no matches, then we would get nothing returned. However, if at least one match, then we would get data returned.

    grantjenkins_4-1679533981438.png

     

    If there is a match, then we expect there to be 1 result. Condition checks the length of the Filter array to determine if any matches. If there are, then we go into the Yes branch and continue. We would use the following expression.

     

    length(body('Filter_array'))

     

    grantjenkins_5-1679534154861.png

     

    Apply to each will iterate over each of the attachments from the email and use Create file to create a file for each one using the Attachments Content. For Folder Path I would use the following expression to build up the path including the Folder with the name of the current Form Number that was matched. If the folder doesn't already exist, it will be created automatically.

     

    //Folder Path
    
    //You would replace /Shared Documents/Assorted Files/ with your base path
    
    concat('/Shared Documents/Assorted Files/', first(body('Filter_array'))?['Form Number'])

     

    grantjenkins_6-1679534526553.png

     

    If we sent an email where the Subject contained 'Form 1' and had three attachments, we would get the following output.

    grantjenkins_7-1679534598916.png

  • FBKB Profile Picture
    5 on at

    Thanks for this reponse.

     

    I have about 500 form numbers, so 5000 is plenty. this is great....however, i think it will create a folder for every single form number every time an email has arrived, because its not in a loop? this means that it takes over 15 minutes to run. 

     

     

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard