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 / READING A LIST OF FILE...
Power Automate
Suggested Answer

READING A LIST OF FILES FROM A FOLDER AND SEND FILES TO PARTICULAR USERS DEPENDING ON NAME OF FILE

(0) ShareShare
ReportReport
Posted on by
Hi,
 
i need a flow using power automate that will read a filenames on onedrive folder and send it to different users
 
Kind regards
Categories:
I have the same question (0)
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,048 Super User 2026 Season 1 on at
    Hi,
     

    1. Trigger

    • Manual trigger or Scheduled trigger (daily/weekly)

    • Or When a file is created in the target folder


    •  

    2. Get Files from Folder

    Action: List files in folder (SharePoint)

    • Site Address: Your SharePoint site

    • Folder Path: Path to your target folder

    • Include Nested Files: Yes (if you want subfolders)


    •  

    3. Parse Filename and Route Files

    Action: Apply to each (Loop through files)

    Inside the loop:

    A. Extract User Identifier from Filename

    Action: Compose


    • Inputs: split(items('Apply_to_each')?['Name'], '_')[0]

    • This extracts the part before the first underscore as user identifier


    •  
     

    B. User Mapping (Choose Method)

    Method 1: Using Switch/Condition

    Switch on: outputs('Compose')
    Case 'john': john.doe@company.com
    Case 'mary': mary.smith@company.com
    Case 'admin': admin@company.com
    Default: manager@company.com
     

    Method 2: Using Compose with Complex Expression

    if(equals(outputs('Compose'), 'john'), 'john.doe@company.com',
    if(equals(outputs('Compose'), 'mary'), 'mary.smith@company.com',
    if(equals(outputs('Compose'), 'admin'), 'admin@company.com', 'manager@company.com')))
     

    Method 3: Using SharePoint List (Recommended)

    • Create a SharePoint list with columns: UserCode, EmailAddress, FullName

    • Use "Get items" action to retrieve mapping

    • Filter by UserCode equals to extracted identifier

    •  

    C. Get File Content

    Action: Get file content (SharePoint)


    • Site Address: Same as above

    • File Identifier: items('Apply_to_each')?['Identifier']


    •  
     

    D. Send Email with Attachment

    Action: Send an email (V2)


    • To: Result from user mapping

    • Subject: File for you: @{items('Apply_to_each')?['Name']}

    • Body: Custom message

    • Attachments:

      • Name: items('Apply_to_each')?['Name']

      • Content: body('Get_file_content')


      •  


    •  
     

    Example Implementation

    Filename Patterns

     
    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz

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 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard