Power Automate: Save Email Attachments To SharePoint Library

Power Automate: Save Email Attachments To SharePoint Library

Email attachments often need to be saved to SharePoint document library. Power Automate can take any incoming/outgoing message and save their email attachments to SharePoint. It can even tag the attachments or place them in a folder for easier lookup in the future.

Table of Contents
• Introduction: The Legal Department Email Attachments AutomationSetup The SharePoint Document LibraryConfigure The "When A New Email Arrives" Trigger SettingsSave Each Email Attachment To The SharePoint Document LibraryRun The Power Automate Flow To Save Email AttachmentsGroup Email Attachments By The Sender In SharePoint

Lawyers working in the legal department of a healthcare company receive email messages from outside consul. When a new email is received in the shared mailbox it attachments are automatically saved to a SharePoint document library using Power Automate.

The email attachments are tagged with the original email’s subject, from email and received date.

Setup The SharePoint Document Library

Create a new SharePoint Document Library named Legal Conversations with the following columns:

  • Name
  • EmailSubject (single-line text)
  • EmailFrom (single-line text)
  • EmailReceived (single-line text)

Configure The “When A New Email Arrives” Trigger Settings

Open Power Automate and create a new automated flow using the Office 365 Outlook – When A New Email Arrives In A Shared Mailbox (V3) trigger. Choose the Folder named Inbox. Select “Yes” for the Only With Attachments field.

Go to the trigger’s Settings and enable Split On. This tells Power Automate to evaluate each email individually as it arrives in the inbox.

Save Each Email Attachment To The SharePoint Document Library

We want to save all email attachments received to the Legal Conversations SharePoint library. Add an Apply To Each action and choose the Attachments output of the trigger.

Then add a Condition inside of the Apply to Each action. Check whether Attachment Is Inline is equal to true. We do this to exclude any embedded images from the flow such as those found in a signature.

Leave the If Yes case empty. Add a SharePoint – Create File action to the If No case. Set the Folder Path to the Legal Conversations SharePoint Document Library. Use the trigger’s Attachments Name as the File Name and the Attachments Content as the File Content.

After the file is created insert a SharePoint – Update File Properties action to tag the file with additional metadata. Use the ItemId of the the newly created file. Then supply the Subject, From and Received Timestamp from the flow’s trigger.

Run The Power Automate Flow To Save Email Attachments

We’re done. Save the flow and perform a manual test. Send an email with attachments to the target email address.

When the email is received the flow saves its attachments to the SharePoint document library.

The attachments appear in the document library as shown below.

Group Email Attachments By The Sender In SharePoint

We can take advantage of the SharePoint document library’s settings to display the attachments grouped by the sender. Go to SharePoint and group the files by the EmailFrom field.

Save the updated view as Grouped By Email From and make it a public view.

The email attachments are now grouped by sender. They can be expanded and collapsed.


If you have any questions or feedback about Power Automate: Save Email Attachments To SharePoint Library please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Notify of

Inline Feedbacks
View all comments
Matt Wright
Matt Wright
2 months ago

Any thoughts on what to do for S/MIME signed documents, where all attachments are embedded in the .smime attachment?

Kindu Melese
Kindu Melese
2 months ago

Hi Matthew
It is really important testimony and I like it

Peter van Vliet
1 month ago

Hi Matthew,

This will work great, but I have some questions here.

Shared Mailbox or any other. This flow will be used for an archiving need in the Netherlands. The use case is that for a municipality all emails of Keyusers (mayor and manager, leaders) will be stored indefinitely. Standard users we will have to store the emails for 7 years.

There are several labels and processes behind this structure (Capstone – Archiving law). This flow is setup for a shared mailbox, but we need to have this working for all mailboxes and depending of the adaptive scope of the users this should be stored following the first part.

My guess is that I can add an extra column to the library and store the label or scope name in there that will show the storage length.

Is it correct to state that the Shared Mailbox was an example flow and that this can be used for all emails.

Question is a bit how much data I will store for keyusers when this is forever and if SharePoint is the correct storage location.