Microsoft Flow or PowerAutomate Example: Save my email attachments to a SharePoint document library

In this Microsoft flow tutorial, We will discuss how we can use the “Save my email attachments to a SharePoint document library” Microsoft Flow Template.

Here, we will create a flow that will trigger when an email with attachments come into my office 365 mailbox.

Save my email attachments to a SharePoint document library – Microsoft Flow Template

Now, we will see how to create the flow.

Login to https://flow.microsoft.com or you can also select Power Automate from Office 365 App Launcher.

Then click on the Templates option in the left navigation and search for Save my email attachments to a SharePoint document library”.

Click on Save my email attachments to a SharePoint document library template.

Save my email attachments to a SharePoint document library
Create Microsoft flow

Here you need to provide your SharePoint, Office 365 Outlook, and Office 365 Users credentials, basically, you need to create the connection.

Save my email attachments to a SharePoint document library flow
Save my email attachments to a SharePoint document library

Click on Continue.

Save my email attachments to a SharePoint document library microsoft flow
Save my email attachments to a SharePoint document library flow template

This will create the flow and it looks like below. By default there will be a few flow actions will be there.

Read Power Automate send email from shared mailbox

First Condition:

Once the flow will open, In the On new email with attachment trigger you can set the below fields:

  • Folder: Click on Show Picker icon >> Select a floder.

In the Initialize IsFromFilterApplied variable action, have the below fields:

  • Name: Initialize the name of the variable as IsFromFilterApplied.
  • Type: Initialize the variable type as Boolean.
  • Value: Initialize the value of the variable as fx false.
Save my email attachments to a SharePoint document library power automate
Save my email attachments to a SharePoint document library

In the Condition action, check if the value is “true” then apply “From” email filter else save an attachment in SharePoint straight.

Condition: IsFromFilterApplied is equal to fx true.

Save my email attachments to a SharePoint document library automatically
Save my email attachments to a SharePoint document library automatically

Now, the If no action, will excute and in the Create file in SharePoint action have the below fields:

  • Site Adress: Select the site address from the drop-down list.
  • Folder Path: Select the folder path from the Show picker icon.
  • File Name: Select the file name from the Dynamic content.
  • File Content: Select the file content from the Dynamic content.
Save my email attachments to a SharePoint document library example
Save my email attachments to a SharePoint document library automatically

In “If no” action, there is Condition SharePoint File Not Created action, where you can set the condition that is Status code is equal to 403 then it will execute the If yes action otherwise If no.

Get my profile to notify error action, Select the field as Mail from the Dynamic Content to get notified via mail.

Save my email attachments to a SharePoint document library ms flow
Microsoft flow template – Save my email attachments to a SharePoint document library

In the next action Send an email to notify error, have the below fields:

  • To: Click on field >> Dynamic content >> select Mail.
  • Subject: Give the subject for the mail.
  • Body: Give the message to be displayed in the mail.
Save my email attachments to a SharePoint document library template
Power Automate example Save my email attachments to a SharePoint document library automatically

Read Power Automate Filter Array

Here, If yes action, it will be not executed at that time, because the condition is not satisfying and it will go to the If No action.

Save my email attachments to a SharePoint document library not working

Once you click on the Save>>Test, it will open the Test Flow window. Select I’ll perform the trigger action >> Save & Test >> Run Flow.

Power automate Save my email attachments to a SharePoint document library

Once the Flow ran successfully, you can see the status now becomes as “Your flow ran successfully” like below. All the steps completed successfully will be notified in green tick mark like below:

Power automate template Save my email attachments to a SharePoint document library

Here, you can see a mail will come with attachment by another user Nancy@***. Go to SharePoint Library and check this attachment is saved or not.

Save my email attachments to a SharePoint document library not working

Once you open SharePoint library >> Go to the folder path that you have selected in the flow. Here you can see the attachment is saved in the Sharepoint library.

Flow template Save my email attachments to a SharePoint document library

Second condition: In this case, Email attachment is not saved to the SharePoint library.

In the second condition, you can initialize the value of variable as “true” to use the “From” filter.

Now, In the Initialize IsFromFilterApplied variable action set the below fields:

  • Name Iniatilze the variable name as IsFromFilterapplied.
  • Type: Select the variable type from the drop-down list as Boolean.
  • Value: Click on the field >> From Expression>> Select true.

In the Condition action, check if the value is “true” then apply from email filter.

Condition: IsFromFilterApplied is equal to fx true.

microsoft flow examples

Now, In the Condition action set the value “true”. Then it will execute the If yes action, then in Check From email address action the expression will “false”. Then it will go to the If no action.

Condition: From is equal to (Bijay@***), you can put any mail id.

microsoft flow examples save email attachments

Once you click on the Save>>Test, it will open the Test Flow window. Select I’ll perform the trigger action >> Save & Test >> Run Flow.

Power automate Save my email attachments to a SharePoint document library

Once the Flow ran successfully, you can see the status now becomes as “Your flow ran successfully” like below. All the steps completed successfully will be notified in green tick mark like below:

Power automate template Save my email attachments to a SharePoint document library

Here, In this case, the email attachment will not saved to the SharePoint library.

You may like the following Microsoft flow tutorials:

In this Microsoft Flow tutorial, We discussed how we can use the “Save my email attachments to a SharePoint document library” Microsoft Flow Template.

  • 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?

  • >