MS Flow: How To Upload In SharePoint Via Email

by | MS SharePoint

In this blog, we’ll create and analyze an MS Flow that doesn’t originate from SharePoint. We’ll use this flow to upload files in SharePoint by sending them through email.

Overview

In this sample Power Automate flow, we need to set up a mailbox where people can submit expense reports, accounting reports, and other files. Those files will be sent to this mailbox, where SharePoint should take and add them to a document library within SharePoint.

Instead of a user going to a document library within SharePoint and adding files there, they email the file to an email address with the subject line being the name of the file. After that, it should automatically be added to the document library.

By learning this, you can have a system where you can send your photos to your central mailbox, and it will add those photos to your central photo library that’s always backed up.

Creating A New Document Library For The MS Flow

First, we’ll create a new document library by clicking New.

MS flow

Next, click Document Library.

Then, it’ll display the Create document library panel.

On the  Name text field, type “Financial Reports”.

Then, click Create.

For now, the new document library should still be empty.

Setting Up An Automated Cloud Flow

Start by clicking Automate.

MS flow

Then, choose Power Automate.

MS flow

Next, click See your flows.

It’ll then redirect you to a new page.

Then, click New flow.

MS flow

Next, click Automated cloud flow.

MS flow

It’ll open a new dialog box.

MS flow

1. Setting Up The Flow Name And Trigger

On the Flow name text field, type “Email to DL”.

MS flow

On the Choose your flow’s trigger text box, choose When an email arrives. Just type “email“, and it’ll suggest the triggers below.

MS flow

Choose When a new email arrives (V3).

MS flow

Then, click Create.

MS flow

Remember that this is usually a centralized email, but for this example, we’ll use a personal email.

After that, a When a new email arrives popup box will appear.

MS flow

We’re only going to set this for emails with attachments. So, click Show advanced options.

MS flow

For the Include Attachments field, set it to Yes.

MS flow

Set the Only with Attachments field to Yes as well.

MS flow

Next, click + New step.

MS flow

This will display the Choose an operation field box.

MS flow

2. Setting Up The Action For Notifications

We’ll send a team message to ourselves, so type “team”, and choose Microsoft Teams.

MS flow

After clicking Microsoft Teams, we need to set the Actions. In our example, we’ll use Post message in a chat or channel.

MS flow

Next, we’ll set the Post in to Channel.

MS flow

After that, set the Team to TestSite.

MS flow

And the Channel should be set to Debug because we’ll use this for debugging purposes.

MS flow

Then, we’ll set the message as “A new file has been added!”.

MS flow

Finally, click Save.

MS flow

Let’s proceed to the next step by clicking + Next Step.

MS flow

3. Setting Up The Action For Uploading Files

Let’s go back to SharePoint by typing “sharepoint” on the search bar.

MS flow

Then, choose SharePoint from the results.

MS flow

For Actions, type “file’ on the search bar.

MS flow

Then click Create file.

MS flow

To create a file, we need to specify the Site Address and the Folder Path.

MS flow

The Site Address is the TestSite. If we click the drop-down menu, you’ll be able to select it.

MS flow

Click the folder icon for the Folder Path.

MS flow

Then, choose Financial Reports from the text box.

MS flow

Next, we’ll set the File Name. We can set it in different ways, but for this example, we’ll set it to Subject. This means the File Name will have the same name as the Subject.

MS flow

Then, the File Content should be set to Attachment Content.

MS flow

Finally, click Save.

MS flow

Testing The Automated MS Flow

To test the flow, let’s click Test on the top right.

Then, click Manually.

Next, click the Test button.

After this, we’ll send an email to this address using another email address. In this example, we’ll send it to Henry, so we’ll type “henrylegge@citizenbuilders.onmicrosoft.com”.

The subject will be “Accounting_20210930”.

Next, we need to attach a file. On this mailing app, we’ll click Insert.

Then click Files.

We’ll attach a random file. For this example, we’ll use “Food Menu”.

Then click Send.

As a result, we should receive the email.

If we go back to our flow, we’ll be able to see each step of the process.

Since we automated a message when a new file is added, we’ll receive a notification on our MS Teams.

And if we go back to the Financial Reports document library, we’ll see a file with the same name as the subject of our previous email.

***** Related Links *****
How To Use Power Automate To Refresh Data In Power BI
Automated Flow In Microsoft Power Automate
Microsoft Flows: Editing And Tracking In Power Automate

Conclusion

To conclude, we’ve successfully created an MS flow for uploading files in SharePoint, which we did by sending the files through email. We also learned how to set up the proper triggers and actions for this specific flow. We tested and monitored the flow, then got the expected results.

This flow is different from using SharePoint Automate because we set the email being received as the trigger, and the action is a file attachment being added to your document library. This is an excellent way to utilize and integrate Power Automate flows within SharePoint.

All the best,

Henry Habib

Related Posts