Save email content to SharePoint

Completed

Microsoft Power Automate provides tools to help you build flows that monitor incoming emails and then save its metadata to Microsoft Lists and its attachment to a document library.

Save email attachments to a SharePoint document library

Microsoft Outlook has a trigger called When a new email arrives, which is used for this unit's example to monitor incoming emails and save the attachments to a SharePoint document library. The trigger is watching to determine if the email has attachments and if it was sent from a specific person with the words "Monthly Report" in the Subject field.

Prerequisites

  • Access to create a SharePoint document library
  • Access to Power Automate

Create SharePoint document library

  1. From a SharePoint, select the Settings gear icon and then select Site contents.

    Screenshot of a Sharepoint page and selecting the gear icon for settings and then selecting Site Contents.

  2. Select + New and then select Document library.

    Screenshot of a SharePoint Site Contents and adding a new document library.

  3. Select Blank Library

  4. In the name field, enter Incoming Emails and then select Create.

  5. Select Add column and select Text. For the name type, select From Name.

    Screenshot of adding a column to a document library.

  6. Select Add column and select Text. For the name type, select From Email.

You now have a document library created.

Create the automated flow

  1. From the Power Automate home page, select + Create on the left hand navigation menu, and then select Automated cloud flow.

  2. Name the flow Incoming Emails.

  3. Search for When a new email arrives(V3) in the Choose your flow's trigger field and select it.

  4. Select Create.

  5. In the top right hand corner, turn off the New Designer and select Switch without Saving when prompted.

  6. Select the trigger and then select Show advanced options.

    Screenshot of the When a new email arrives (V3) trigger with the Show advanced options command highlighted.

  7. Add the options to help monitor the incoming emails closely and only capture the attachments from those who match your criteria. This example is monitoring the To, From, Include Attachments, and Subject Filter fields.

    Screenshot of the advanced options filled in.

  8. Select + New Step. Search for Sharepoint and then select Create file.

  9. Select the Site Address and Folder Path for the Incoming Emails library.

    Screenshot of the Create file dialog box with Folder Path selected and Incoming Email highlighted.

  10. Select the File Name field. The dynamic content box should open. If it doesn't, select Add dynamic content. From the dynamic content, select Attachments Name

    Note

    Power Automate automatically adds an Apply to each action outside of the Create File. This is to make sure that all attachments from the email are created in the SharePoint library.

  11. Select the File Content field. Select Attachments Content from the dynamic content.

  12. Beneath the Create file action, select Add an action again, search for SharePoint, and then select Update file properties.

  13. In the Update file properties dialog box, select the Site Address and the Incoming Emails library.

  14. Add the information from dynamic content shown in the following screenshot.

    Screenshot of the Update file properties dialog box.

  15. Select Flow checker to review for any errors and then select Save in the top right hand corner.

    Screenshot of the completed flow properties

Run the flow

Your task is complete. Now, when Adele Vance receives an email from Miriam Graham and the email:

  • has at least one attachment

  • Subject field contains the words "Monthly Report"

Then the flow picks up the attachments and saves them in the Incoming Emails library.

The following screenshot shows what the SharePoint library looks like after an email was received.

Screenshot of the SharePoint library for Incoming Email.

Tip

When a file is uploaded to SharePoint, its file size is automatically identified and made available. The column name is called File Size and is hidden by default. You will need to add it to the view to display it.