Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Save Attachments from Email to Specific Sharepoint Folder

(0) ShareShare
ReportReport
Posted on by 190

In this flow, when I receive an email with attachments in my mailbox and it will automatically store it in SharePoint site. but I don't want to put the folder configuration directly into a flow. I want to keep the attachment-folder configuration outside of it, in a configuration list. I want to put the email attachments with an specific file name to a specific folder (per a company), but when the file name isn't correct, the attachments file will be stored to Others Folder. The problem is when I sent an email, the attachments was stored to "Company Folder" and "Others Folder"

 

This is my flow:

pritadewii_0-1698287777723.png

pritadewii_1-1698287913118.png

pritadewii_3-1698288009035.png

pritadewii_6-1698288221813.png

pritadewii_7-1698288245804.png

*Site Address deleted for sensor only

**The rest apply to each has exactly the same flow but the folder path has different name (per company)

 

This is the result in sharepoint site:

pritadewii_8-1698288751222.png

pritadewii_9-1698288780570.png

 

  • Verified answer
    NicholasNg Profile Picture
    53 on at
    Re: Save Attachments from Email to Specific Sharepoint Folder

    Your problem is probably because you have an apply to each for each company. So for the "apply to each" flow, it sends the file to the correct location. In "apply to each 2" since the file doesn't have that company's name inside, it'll send the file to your others folder. The error will pop up in "apply to each 3" since it's trying to create the file again in the others folder.

     

    Keep it to 1 apply to each workflow and nest your conditions. In apply to each, you can use the same condition, and yes flow. Then under no, instead of create the file in the others folder, you make it do another condition step based on the next company's name. Repeat until you complete all the companies required.

  • CFernandes Profile Picture
    8,295 Most Valuable Professional on at
    Re: Save Attachments from Email to Specific Sharepoint Folder

    Hey @pritadewii You can use Switch condition and route the attachments to specific folder... You can find a video tutorial at https://www.youtube.com/watch?v=_jh7snqA4e4 

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

  • pritadewii Profile Picture
    190 on at
    Re: Save Attachments from Email to Specific Sharepoint Folder

    Hi @v-xiaochen-msft 

     

    This is the error:

    pritadewii_0-1698291884481.png

    pritadewii_1-1698292011732.png

     

  • v-xiaochen-msft Profile Picture
    on at
    Re: Save Attachments from Email to Specific Sharepoint Folder

    Hi @pritadewii ,

     

    Everything looks fine from your screenshots.

    Can you check which loop of which branch caused the wrong file upload?

    It will help to solve the problem if you provide relevant screenshots.

     

    Best Regards,

    Wearsky

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1