How to Save Email Attachment to SharePoint Using Power Automate?

While working on a Power Automate, I needed to save email attachments directly to a SharePoint document library. The team wanted a simple way to keep all important files from emails in one place without manually downloading and uploading them.

Handling multiple emails daily made this process time-consuming, so I used Power Automate to automate it. This way, all attachments were automatically saved to the correct folder, saving time and effort.

In this tutorial, I will show you how to save email attachments to a SharePoint document library using Power Automate. Whether you want to save all attachments, organize them based on the sender or subject, or filter specific file types like PDFs.

Save Email Attachments to SharePoint using Power Automate

Suppose your HR team receives job applications via email with resumes attached as PDF files in your organization. They want to automatically save these resume attachments to a SharePoint document library named Job Applications for better organization and accessibility.

save outlook attachments to sharepoint

Now follow the below steps:

1. Create an automated cloud flow with a trigger When a new email arrives (V3), action and provide the below parameters:

  • Folder: Click on the File icon and choose the inbox option.
  • Include Attachments: Select the yes option from the drop-down.
how to save an email attachment to sharepoint

2. Add Apply to each action, then select an output from the previous steps box inside. Provide attachments from dynamic content for when a new email arrives.

how to save attachments from outlook to sharepoint

3. Inside the Apply to each action, add a Get Attachment (V2) from the outlook connector and provide the below parameters:

  • Message Id: Provide Message Id from dynamic content When a new email arrives.
  • Attachment Id: Provide Attachment Id from dynamic content When a new email arrives.
save email to sharepoint power automate

4. Then, Inside the Apply to each loop, add a Create file action and provide the below parameters:

  • Site Adress: Select the site address from the drop-down list.
  • Folder Path: Select the folder path from the file icon.
  • File Name: Provide the Attachment file name from the dynamic content.
  • File Content: Provide the content bytes from dynamic content.
power automate save email attachment

Now save the flow and run the flow manually. Then save an email test user to this account when you create flow.

As you can see, I received an email with an attachment from a test user.

microsoft flow save email to sharepoint

After the flow runs successfully, check whether the SharePoint document library to the file is present.

Save Email Attachments to SharePoint using Power Automate

Save Email Attachments to SharePoint Based on the Sender in Power Automate

Suppose the finance team regularly receives invoices from multiple vendors via email. To make essay their document management, they want to save these invoices to a SharePoint document library named Vendor Invoices.

The attachments should be saved in subfolders based on the sender’s email address (If invoices are from [email protected], go to the Vendor1 folder; invoices from [email protected] go to the Vendor2 folder).

power automate save email attachment to sharepoint

In this example, I will tell if the email came from User2. It will be stored in the User2 folder.

To do this, follow the below steps:

1. Create an automated cloud flow with the trigger. When a new email arrives (V3), action and provide the below parameters:

  • Include Attachments: Select the yes option from the drop-down.
power automate export email to sharepoint

2. Then add a condition action that checks whether the email came from User2.

@{triggerOutputs()?['body/from']} is equal to [email protected]
save email from sharepoint to outlook

3. Then, in the true section, add the Get Attachment action and provide the Message Id and Attachment Id.

It will automatically add a For each loop.

outlook save email to sharepoint in Power Automate

4. Then, Inside the For each loop, add a Create file action and provide the below parameters:

  • Site Adress: Select the site address from the drop-down list.
  • Folder Path: Select the folder path by clicking the file icon.
  • File Name: Provide the Attachment file name from the dynamic content.
  • File Content: Provide the content bytes from dynamic content.
Power Automate save from outlook to sharepoint

Now save the flow and run it. When you receive an email for User 2, it will be stored in the User 2 folder.

Power Automate save outlook email to sharepoint

You can use the switch condition if multiple users are interested in condition action.

Save Email Attachments to SharePoint Based on Subject Filter Contains the Value in Power Automate

In the above example, we see a specific user. Now, I will show you how to save email attachments to SharePoint based on the subject filter containing the value in Power Automate.

Now follow the below steps:

1. Create an Automated Cloud Flow using the Outlook connector’s ‘When a new email arrives (V3)‘ trigger. Then Provide below parameters:

  • Include Attachments: Select the yes option from the drop-down.
Power Automate outlook save email to sharepoint

2. Then expand the Advanced parameters, select Subject Filter inside the box, and put your filter value.

In my case, I want to save the attachment in sharepoint when the subject contains a particular keyword, such as Invoice.

save email from sharepoint to outlook Power Automate

3. Then add a Get Attachment action and provide the Message Id and Attachment Id from When a new email arrives (V3).

It will automatically add a For each loop.

save email attachment in power automate

4. Inside the For each loop, add a Create file action and provide the below parameters:

  • Site Adress: Select the site address from the drop-down list.
  • Folder Path: Select the folder path by clicking the file icon.
  • File Name: Provide the Attachment file name from the dynamic content.
  • File Content: Provide the content bytes from dynamic content.
Power Automate save email to sharepoint document library

Save the flow and run it. When you receive an email, the flow will check if the subject contains the word ‘Invoice‘ and store the attachment in the SharePoint document library.

How to Save Email Attachment to SharePoint using Power Automate

Save Only PDF Attachments in SharePoint Document Library using Power Automate

Imagine you’re working in the HR department of a company and frequently receive emails containing various file attachments (PDFs, images, Word documents, etc.). These attachments often include employee documents such as resumes, certificates, or signed agreements.

However, you only need the PDF files from these emails to be stored in a SharePoint document library called Employee Records for easy access and organization.

Save from outlook to sharepoint Power Automate

To do this, follow the below steps:

1. Use the “When a new email arrives (V3)” trigger to monitor a specific folder in your Outlook inbox. Then Provide below parameters:

  • Include Attachments: Select the yes option from the drop-down.
  • Folder: Select the Inbox from the drop-down.
Save Only PDF Attachments in SharePoint Document Library Power Automate

2. Then add a Get Attachment action and provide the Message Id and Attachment Id from When a new email arrives (V3).

It will automatically add a For each loop.

save email attachment in power automate

3. Then add a Condition action and provide the below condition:

Name ends with .pdf
Save Only PDF Attachments in SharePoint Document Library using Power Automate

4. Add the Create file action to upload the PDF to your SharePoint document library (Employee Records) in the Ture section.

  • Site Adress: Select the site address from the drop-down list.
  • Library Name: Employee Records
  • File Name: Attachment Name
  • File Content: Attachment Content
Save Only PDF Attachments in SharePoint Document Library in Power Automate

Save the flow and Send a sample email with multiple attachments (PDF and non-PDF) to verify that only PDF files are saved in the document library.

I received an email with three attachments (JohnDoe_Resume.pdf, JohnDoe_ProfilePicture.jpg, Signed_Agreement.pdf).

How to Save Only PDF Attachments in SharePoint Document Library using Power Automate

The flow will ignore JohnDoe_ProfilePicture.jpg and only upload JohnDoe_Resume.pdf and Signed_Agreement.pdf to the Employee Records library.

Power Automate Save Only PDF Attachments in SharePoint Document Library

This way, you can save only specific types of attachments, like PDFs, in the SharePoint document library.

Conclusion

This tutorial covered how to save email attachments to a SharePoint document library using Power Automate. We explored scenarios such as saving all attachments, saving attachments based on the sender, filtering attachments by subject, and saving only specific types of attachments like PDFs. These automated workflows make managing email attachments easier, save time, and ensure better organization in your SharePoint libraries.

You may also like:

  • I’m not sure where you found the condition called, Condition SharePoint File Not Created action. I don’t see that as part of the condition list.

  • I cannot wrap my head around this particular flow. Why does it need IsFromFilterApplied condition? Cannot I just specify from e-mail address in trigger if I want this flow to save attachments from mails from particular person? What’s the difference?

  • >

    Build a High-Performance Project Management Site in SharePoint Online

    User registration Power Apps canvas app

    DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

    Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

    Power Platform Tutorial FREE PDF Download

    FREE Power Platform Tutorial PDF

    Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…