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 / Large File Email Attac...
Power Automate
Answered

Large File Email Attachments to SharePoint Folder

(1) ShareShare
ReportReport
Posted on by 166
Hi,
 
I am currently building a flow that gets all file attachments from an email to SharePoint, but I am currently facing slowness wherein an email may contain more than 10 files and may reach more than 40Mb in total file size. The attachments may be a mix of PDF and XLS files and the goal is to create a SharePoint folder for each email received. I already set the concurrency to 30 but still having issue.
 
Is there an alternative way to bypass 'for each' action and same for 'for each' that will upload the files in a sharepoint folder.
 
I have this flow working but having issue when it comes to bulk sizes: 
 
Categories:
I have the same question (0)
  • Verified answer
    Riyaz_riz11 Profile Picture
    4,122 Super User 2026 Season 1 on at
    Hi,
     

    Solution 1: Batch Processing with Parallel Branches (Recommended)

    Replace your current "For each" loops with parallel branches:

    When a new email arrives
    ├── Compose folder name
    ├── Compose file path
    ├── Create new folder
    ├── Create sharing link
    └── Parallel Branches (Split attachments into batches)
        ├── Branch 1: Process attachments 1-3
        ├── Branch 2: Process attachments 4-6
        ├── Branch 3: Process attachments 7-9
        └── Branch 4: Process attachments 10+

    Implementation:


    1. Split attachments array using take() and skip() functions

    2. Create 3-4 parallel branches to process attachments simultaneously

    3. Each branch processes 3-5 attachments in a smaller "For each" loop

    4.  

    Expression Examples:


    • Branch 1: take(triggerOutputs()?['body/attachments'], 3)

    • Branch 2: take(skip(triggerOutputs()?['body/attachments'], 3), 3)

    • Branch 3: take(skip(triggerOutputs()?['body/attachments'], 6), 3)

    •  

    Solution 2: Eliminate Redundant Actions

    Current Flow Issues:


    • Creating sharing link for EACH attachment (unnecessary)

    • Individual folder creation calls

    • Separate compose actions for each attachment

    Optimized Flow:

    When a new email arrives
    ├── Compose folder name (once)
    ├── Compose base file path (once)
    ├── Create new folder (once)
    ├── Parallel Attachment Processing
    └── Create sharing link (once, at the end)

    Solution 3: Use SharePoint REST API Batch Requests

    Replace individual "Create file" actions with batch upload:

    HTTP Action - Batch Upload

    Method: POST
    URI: _api/$batch
    Headers:
    {
      "Accept": "application/json",
      "Content-Type": "multipart/mixed; boundary=batch_[guid]"
    }
    Body: [Batch request with multiple file uploads]

    Benefits:


    • Single API call for multiple files

    • Reduced network overhead

    • Faster processing

    •  

    Solution 4: Conditional Large File Handling

    Add file size checking to handle large files differently:

    Condition: length(triggerOutputs()?['body/attachments']) > 10MB
    ├── True: Use chunked upload for large files
    └── False: Use standard upload

    Large File Upload Method:

    Method: POST
    URI: _api/web/GetFolderByServerRelativeUrl('[folder-path]')/Files/StartUpload(uploadId=guid'[new-guid]')

    Solution 5: Optimized Flow Structure

    Complete Optimized Flow:

     
    When a new email arrives (V3)
    ├── Initialize variable - Email ID
    ├── Initialize variable - Folder Name
    ├── Initialize variable - Attachments Array
    ├── Compose - Create folder path
    ├── HTTP POST - Create folder (single call)
    ├── Condition - Check attachment count
    │   ├── ≤ 5 attachments: Standard processing
    │   └── > 5 attachments: Parallel processing
    ├── Parallel Branches (for > 5 attachments)
    │   ├── Branch 1: HTTP POST Batch Upload (files 1-5)
    │   ├── Branch 2: HTTP POST Batch Upload (files 6-10)
    │   └── Branch 3: HTTP POST Batch Upload (files 11+)
    └── HTTP POST - Create sharing link (once)
     
    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
  • Ellis Karim Profile Picture
    12,047 Super User 2026 Season 1 on at
    We need more details to help you! Please share a screenshot of your flow, showing the configured actions. If there’s an error, tell us which action failed and include the error message. This will help us understand the issue and provide a solution faster. Thank you!
     
     
    @ComicSansrival The runtime output doesn't provide any useful info.
     
     
    Ellis Karim
    Ellis Karim
    Blog | LinkedIn | Bluesky
    If this solved your issue, please mark it as ✅ Accepted Answer. If it helped, feel free to give it a 🩷 Like!
  • Tomac Profile Picture
    4,053 Moderator on at
    Please post screenshots of the action within your Apply To Each that's having the error, with that action expanded to show the inputs, outputs, and error message

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
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 820

#3
Haque Profile Picture

Haque 505

Last 30 days Overall leaderboard