
Action: List files in folder (SharePoint)
Action: Apply to each (Loop through files)
Inside the loop:
Action: Compose
split(items('Apply_to_each')?['Name'], '_')[0]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)
Action: Get file content (SharePoint)
items('Apply_to_each')?['Identifier']Action: Send an email (V2)
File for you: @{items('Apply_to_each')?['Name']}items('Apply_to_each')?['Name']body('Get_file_content')john_report_2024.xlsx → sends to john.doe@company.commary_invoice_001.pdf → sends to mary.smith@company.comadmin_backup_data.zip → sends to admin@company.com