How to Auto-Save Email Attachments to SharePoint in 4 Steps

C
Collab365 TeamEditorialPublished Mar 30, 2026
11

At a Glance

Target Audience
Power Automate Developers, SharePoint Admins, Microsoft 365 Specialists
Problem Solved
Manually downloading, organizing email attachments from Outlook to SharePoint
Use Case
Automating invoice processing by saving vendor attachments from AP emails to SharePoint for approvals

Most companies rely on humans to act as routers. You receive an email. You download the attachment. You upload it to a SharePoint folder. It is a massive waste of time. Your team should be doing actual work, not dragging and dropping PDFs.

Fix the process first. Then let Power Automate handle the repetitive clicks.

Manual filing leads to lost documents and broken workflows. You can automate this entirely. Here is what happens when you stop acting like a router:

  • Contract Management: Route legal PDFs straight to a secure document library.
  • Invoice Processing: Speed up approvals by routing vendor bills directly to Accounts Payable.
  • Recruiting: Drop candidate resumes right into their SharePoint profiles.
  • Support Tickets: Send error logs and screenshots straight to the active ticket for immediate reference.

Here is the high-level view of how we build this.

email attachement flow
email attachement flow

Step 1: The Trigger

You do not need a complex setup to start. Create an Automated Cloud Flow and use the "When a new email arrives (V3)" trigger. Connect your Outlook account.

create cloud flow
create cloud flow

Turn "Include Attachments" to Yes. If you skip this, the flow fails.

new email trigger
new email trigger

Do not let this run on every single email. Filter it. For this build, we only trigger when the subject contains "AttachmentSave" and the email actually has an attachment.

Step 2: Naming Conventions

If you hardcode names, your flow will overwrite files. You need dynamic naming. Initialize two variables. One for the folder and one for the file.

Use formatDateTime(utcNow(),'yyMMdd') to stamp the current date. Combine it with the Email ID using the concat function so every file is entirely unique.

initialize file name variable
initialize file name variable

Do the same for the folder. Grab the first 10 characters of the subject line and append the date.

folder name variable
folder name variable

Step 3: Creating the Destination

Now we build the house for the data. Use the SharePoint "Create New Folder" action.

create new folder action
create new folder action

Pick your site address and document library. Pass your folder variable into the Folder Name field.

Next, we want to keep a record of the actual email. Use "Export Email (V2)".

export email action
export email action

Pass the Message ID from your trigger. Then use "Create File" in SharePoint to drop the .eml file into your newly created folder.

create file action
create file action

Step 4: Moving the Attachments

Add a condition to check for attachments. Use the expression length(triggerOutputs()?['body/attachments']) and check if it is greater than zero.

condition number of attachements greater zero
condition number of attachements greater zero

If yes, add a "Create File" action.

create attachement file
create attachement file

The moment you select "Attachment Name" from the dynamic content, Power Automate will automatically wrap your action in an "Apply to each" loop. It knows there might be multiple files. Let it do its job.

apply to each attachement
apply to each attachement

Run a test. Send an email with three files. Watch them appear in SharePoint seconds later.

email attachements in sharepoint
email attachements in sharepoint

Notice the extra image file? That is your email signature. Power Automate treats inline images as attachments. Plan for it.

The Master List: Edge Cases & Community Fixes

You will eventually hit edge cases. When you do, do not reinvent the wheel. The community has already solved them. Here is a master list of resources for when things get weird.

If you are dealing with folder actions or trying to export from a shared mailbox, you have options. People are constantly archiving emails and setting up complex trigger conditions. You might need to parse XML data or troubleshoot template errors. There is always a helpful tutorial to guide you.

Filing logic can get messy. You can route files to a custom path, check out social discussions, or auto-create subfolders. If you get stuck, forum solutions, video guides, and threads on auto-saving to SharePoint are lifesavers.

Dates are notorious for breaking flows. Whether you need the yyyymmdd format, a specific power platform thread, or a fix for an attachment format issue, the answers are out there. Master the concat function and learn the best way to create folders. You can export emails in 5 steps, place items in a folder, and manage the folder and file hierarchy. Look into dependency tracking and the official expression reference.

Institutions even document this, like this UConn KB. You can watch another video on the V3 difference, learn to create folders with C# logic, or follow a YouTube walkthrough. If you hit a has attachments issue, read up on how to save the email message.

For deep formatting, check out guides on formatting datetime, PowerGI's date tips, and creating an attribute-based ID. Browse the Dynamics forum, read PowerPlatformer, or study Matthew Devaney's examples. Engage with the community thread, the Fabric community, and read up on email triggers.

When things break, consult forum posts, the ideas portal, or a video resource. There is always a YouTube demo, a Rishona blog, or a forum thread ready to help. Expand your knowledge with a Dynamics blog, the Power Platform Dude, and the create new folder action docs.

Still stuck? Read another Dynamics post, figure out why no attachments are found, or practice your Power Automate gymnastics. Watch a YouTube clip, review date time values, or follow a video tutorial. You can even export to OneDrive, watch a YouTube guide, or join a community discussion.

Master the Office 365 connector, learn body functions, and save attachments to a library. If you hit a forum thread about a unique ID error or an infinite loop, do not panic. People use this for everything from Survey123 to Power Streamline. Tweak your trigger settings, learn from a citizen developer, format your dates properly using standard functions, and master desktop datetime.