Save my email attachments to a SharePoint document library Power Automate or Flow

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.

Send my email attachment to a SharePoint document library

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 templatesave 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.

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

Then make sure to connect to SharePoint, Office 365 outlook and Office 365 Users.

Save my email attachments to a SharePoint document library flow

Then click on Continue. Once you click on the Continue button it will create the flow and the flow looks like below:

save email attachments to sharepoint

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:

save email attachments to sharepoint document library

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.

how to save email attachments to sharepoint library

Here, select your SharePoint Online site and the SharePoint document library where you want to save the email attachments.

save my email attachments to a sharepoint document library

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.

microsoft flow save my email attachments to a sharepoint document library

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.

save my email attachments to a sharepoint document library flow

Once you received an email, the flow will trigger and you can see the file will be created in the SharePoint document library.

save my email attachments to a sharepoint document library power automate

Save my email attachments to a SharePoint document library automatically from a particular email address

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.

1st modification:

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.

microsoft flow save my email attachments to a sharepoint document library

Now, the value of the variable will be true like below:

save my email attachments to a sharepoint document library automatically

2nd Modification:

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.

save my email attachments to a sharepoint document library flow

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.

microsoft flow email address case sensitive

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:

save my email attachments to a sharepoint document library

The flow triggers and you can see the attachment got saved in the SharePoint Online document library.

save my email attachments to a sharepoint document library flow

This is how we can save my email attachments to a SharePoint document library automatically.

What will happen if the attachment already exists in the SharePoint document library?

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:

  • Hi sir
    Is there a way to upload pdf documents from local to multiple share point lists based on ID

  • Thank you Bijay! I have a question – we have an email called accounting to which all our vendors send thier invoices to. I need all attachments that are sent to that email to be saved to Sharepoint. So instead of from email address do I use to email address?

  • >