In this Microsoft flow or Power automate tutorial we will discuss how to save my email attachments to a SharePoint document library Power Automate or flow.
Basically, it will save the attachments coming to my Office 365 email box. We will also see how to save email attachments from a particular person or from a particular email address to the SharePoint library through a flow.
If you are new to Microsoft flow of power automate I can check out an article that I wrote on what is Microsoft flow and how to start with Microsoft flow.
SharePoint Online tutorial contents:
- Send my email attachment to a SharePoint document library
- Save my email attachments to a SharePoint document library automatically from a particular email address
- What will happen if the attachment already exists in the SharePoint document library?
- If email contains multiple attachments?
A lot of times you might require to save important email attachments to the SharePoint document library. Or maybe you want to save the attachments coming from a particular person like your manager or CEO or director.
So in this example, we are going to use the Microsoft flow template “save my email attachments to a SharePoint document library” to create a flow, that will save all the email attachments from everyone to the SharePoint library.
As well as I will show you how to specify a particular from address, and emails coming from that particular email address if contains attachments, then it will save to the SharePoint library.
Let us see how to create this flow.
Login to https://flow.microsoft.com and then provide your office 365 credentials to log in.
Once login in from the left navigation click on the Templates button And then search for the template “Save my email attachments to a SharePoint document library” like below.
Then Select the template.
Then make sure to connect to SharePoint, Office 365 outlook and Office 365 Users.
Then click on Continue. Once you click on the Continue button it will create the flow and the flow looks like below:
Now let us understand how this flow works.
First, we need to select the folder, for this click on, on new email with attachment flow action. Their select Inbox, you can also select other folders of your email like Archive, Conversion History, Deleted Items, Draft, Junk Email, etc like below:
Then you can see Microsoft flow added a few other flow actions like Initialize variable and Condition. The first time the value of the IsFromFilterApplied variable is False, that means there is no from address filter is there.
So it will save all the attachments coming from any email address.
Later, we will make it to true and we will see how it is working for a particular From address.
Since the variable condition is set to No, it will go to the No condition. And this will save attachments to the SharePoint document library.
Here, select your SharePoint Online site and the SharePoint document library where you want to save the email attachments.
Note: Make sure to provide the site address and SharePoint document library name in both Yes and No condition.
And if for any reason, it is not able to create the file or save the attachment to the SharePoint library, then it will trigger an email to the user. In those case the status error code will be 403.
Now, we can test the flow. So save the flow and then when you receive an email with attachment(s) from others you can see the attachment(s) got saved to the SharePoint library.
Once you received an email, the flow will trigger and you can see the file will be created in the SharePoint document library.
Now, we will see how to save my email attachments to a SharePoint document library automatically from a particular email address.
We need to edit the flow and for this, we need to change in two places in the flow.
First, we need to set IsFromFilterApplied variable value to true.
Edit the flow and click on Initialize variable workflow action, go to Expression, type true, and click on OK.
Now, the value of the variable will be true like below:
Now, we need to set the From email address in the Check From email address flow action. That will available in the If Yes part.
There provide the email address. In this case, you can see below I have provided the email address.
Microsoft Flow email address case sensitive
I want to add a note here, the Microsoft flow email address is case sensitive. So the From email address you are providing here will be case sensitive.
So if you are not sure, what exactly your from Email address is, you can add a variable and try to send the From email address value like below:
Microsoft flow email address case sensitive.
Here, I have just created a string variable and assign the From value to it and then I am sending the value in my email. This is just a way to get the exact email id.
Now, our flow is ready for testing. Now, if an email is coming from the particular email address, then the attachment will be saved to the document library.
If the email is coming from other email addresses then it will not save.
Here I have sent an email from Bhawana email address like below:
The flow triggers and you can see the attachment got saved in the SharePoint Online document library.
This is how we can save my email attachments to a SharePoint document library automatically.
Lot of time you will see the attachment or file with the same name already exists in the SharePoint document library, what the flow will do that time?
It will override the file, basically it will replace the new file with the old file.
If email contains multiple attachments?
If the email contains multiple email attachments, then it will save all the files in the SharePoint document library.
In this tutorial, we learned how to save my email attachments to a sharepoint document library using Power Automate or Microsoft flow.
Also, we explore how to configure the flow, so that it will save my email attachments to a SharePoint document library only if it is coming from a particular email address.
You may like the following Power Automate tutorials:
- SharePoint auto generate column value using Power Automate or Flow
- Microsoft flow Send an email showing wrong time for SharePoint list column
- Microsoft flow change true to yes
- How to get manager email or name in Microsoft Flow
- Microsoft Flow Example: Product Notification Approval Flow
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site EnjoySharePoint.com