Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Save email attachment to a specific SharePoint folder (Power Automate)

Posted on July 10, 2022July 10, 2022 by Tom

“I’ve got a dedicated mailbox collecting emails with various attachments. Can I use Power Automate to save them from the email to a specific SharePoint folder based on the attachment type?”


One of the basic use cases for Power Automate is to save attachments from incoming emails. You receive an email in your mailbox and it’ll automatically store it to OneDrive or a SharePoint site. But with the basic solution it’ll save all the attachments to one place. That’s still a lot of work for you to organise them later.

Wouldn’t it be nice if you could automate also this step? To save the attachment in a specific folder based on its type?

Create a configuration list

As explained in a previous article, you don’t want to put the folder configuration directly into a flow. You want to keep the attachment-folder configuration outside of it, in a configuration list. And that’s the first step – create a configuration list in SharePoint. The list needs just 2 columns, the file type (or some other part of the file name) and the folder.

Use it to get the file location

Now, with the configuration list in place you can start with the flow. Start with the trigger ‘When a new email arrives’, potentially with a trigger condition on attachments or email subject(s). Among the trigger outputs will be also the email attachments and their properties, including the attachment name.

The attachment name is important because that’s what the processing is based on. Extract the part that’s used in the configuration list, in this case the file extension…

last(split(items('Apply_to_each')?['name'],'.'))

… and use it in a lookup to the configuration list.

Save the file

The ‘Get items’ action will return one item from the configuration list, the one with the destination folder. Use it in the folder path in the ‘Create file’ action.

Power Automate save email attachment folder

Don’t worry about the automatically added ‘Apply to each 2’. Since there’s only 1 entry in the configuration list for the file type it’ll always return only 1 item = it’ll run only once.

Summary

You can use Power Automate not only to save email attachments, but also to save each attachment in a specific folder. Firstly, create a configuration list based on a part of the file name. Secondly, parse the file name and use it to lookup the config list. Finally, once you have the folder from the config list, use it to store the file in the right folder.

The benefit of using a configuration list is that you can easily add another type/folder configuration. Just add them to the configuration list and flow will take care of the rest, including creation of the folder(s).


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes