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.
Here you need to provide your SharePoint, Office 365 Outlook, and Office 365 Users credentials, basically, you need to create the connection.
Click on Continue.
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.
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.
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.
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.
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.
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.
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.
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:
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.
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.
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.
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.
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.
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:
Here, In this case, the email attachment will not saved to the SharePoint library.
You may like the following Microsoft flow tutorials:
- Convert SharePoint document to PDF using Power Automate
- Convert SharePoint list item to PDF using Flow or Power Automate
- Convert Email to PDF using Microsoft flow or Power Automate
- Saving microphone audio recorded in PowerApps to SharePoint online
- Microsoft Flow or PowerAutomate: Trigger email based on user input
- Get a push notification when a new file is added to OneDrive for Business (Power Automate example)
- Save Twitter Tweets in SharePoint Online list using Microsoft Flow (Power Automate)
- Get daily weather reports delivered to your email and phone using Power Automate
- Send myself a reminder in 10 minutes in Power Automate
- Microsoft Flow or PowerAutomate Example: Send a customized email when a new file is added
- Unable to process template language expressions in action Power Automate
- Power Automate get events into excel
In this Microsoft Flow tutorial, We discussed how we can use the “Save my email attachments to a SharePoint document library” Microsoft Flow Template.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com
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?