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 / Route attachments from...
Power Automate
Answered

Route attachments from email into a SharePoint library (folders) when there are 130+ locations

(1) ShareShare
ReportReport
Posted on by 48
We have an shared email inbox where emails (with multiple attachments) come in with a subject line with the location number in it. There are 130+ locations. We want to route the attachments to a SharePoint document library, and were thinking we could create 130+ folders and according to which location it is, the attachments would drop into the corresponding location SharePoint folder. 
However, creating 130+ conditions/apply to each would make for one hefty Flow!
Is there a better way with this scenario?
I was thinking to create a column for the location, and have the Flow update the file properties to place the location number in the column and then group by location in the SharePoint library view, but there are going to be a lot of files here and a grouping view may not eventually work very well as the library eventually gets to 5000+ files. 
 
Any ideas on this one? I'd appreciate any guidance on this, thanks!
Categories:
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    16,244 Super User 2026 Season 1 on at
    Hi there!
     
    I found a sample flow I had and modified it to show you the steps.  Essentially you can use substring to get the location out of the subject line using a compose.
     
    In my example, the location is the first 6 characters of the subject but there are a TON of ways to get the exact location and exact location details.  Easy peasy.
     
    So you don't need to have 130 conditions, one create file action will work.  Again, this is just an example and here I'm only working with pdf attachment files so you may not even need the condition.
     
    But in the create file action, part of your hard-coded URL will contain the dynamic content from the subject for your location#.
     
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and check the box below "Does this answer your question" to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

  • Verified answer
    trice602 Profile Picture
    16,244 Super User 2026 Season 1 on at
    Here's another variation:
     
    Here I know that my Subject always includes "Location#" in the subject and I want the number 6 characters after it to get 123456 such as
     
    Location# 123456
     
    So know my compose substring expression is
     
    substring(triggerOutputs()?['body/subject'],add(body('Find_text_position'),11),6)
     
    the length of "Location# " is 10
     
    so I want to start in position 11 and get the next 6 characters.
     
     
     
  • DS1 Profile Picture
    48 on at
    Thanks very much, @trice602 - going to test these out. Much appreciated! 

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 582

#3
Haque Profile Picture

Haque 529

Last 30 days Overall leaderboard