For the On-prem Sharepoint sites, You can upload a file to a SharePoint document library via email using the “Incoming email support” feature, which is available in the Document Library Settings, Picture Library Settings, or Form Library Settings. This feature is currently not supported in SharePoint Online.
To address this limitation in SharePoint Online, one of the alternative solutions is to use Power Automate flows. This allows you to achieve similar functionality to uploading files via email by creating custom automated processes using Power Automate.
A third-party vendor has asked you to set up a dedicated SharePoint site for uploading and sharing documents with your company’s users. This entails configuring External Access settings in the SharePoint Admin Center and configuring Azure B2B collaboration settings to facilitate secure external collaboration.
Once you’ve completed the configuration of External Access in SharePoint and Azure B2B, you can proceed to invite a guest user to your Azure Active Directory (AD) tenant. This step will enable you to grant access to the SharePoint site, allowing the external vendor to both upload and download files securely.
In some organizations, stringent security policies prohibit External Access to SharePoint and may even disable Azure B2B collaboration. While these settings provide a high level of security and protect the organization from potential external threats, they can be less flexible and may not be ideal for fostering collaboration with external partners. The balance between security and collaboration needs to be carefully considered to meet the organization’s specific requirements.
To upload files to a SharePoint Online document library without making any changes to the External Access settings or Azure B2B collaboration settings, you can utilize Power Automate flows.
Before proceeding with this, it’s important to ensure that you have the appropriate type of Power Automate license assigned to you, as it’s a requirement for creating and working with Power Automate flows effectively.
I’ll begin from the scratch by creating a SharePoint site and setting up a document library. Any files sent as email attachments to a particular email address will be automatically placed in this SharePoint document library. Let’s check the steps:
Table of Contents
Step 1 – Create a Sharepoint Site
If you’ve already got a SharePoint site and a document library where you intend to upload files via email, you can skip this particular step. Let’s move on to the steps for creating a SharePoint site.
- Login on Microsoft 365 admin center > Click on Sharepoint under Admin centers.
- Go to Sites > Active Sites
- Click on + Create link
- Select the Team Site option on the Create a Site pane
- Provide a Site name, Group Owner information
- Click on Next and then Click on Finish.
Step 2 – Create a Document Library
Document libraries serve as versatile storage spaces for various file types, such as documents, spreadsheets, presentations, images, and videos. Additionally, you have the option to create folders within these libraries, which can help you further organize your files efficiently.
For creating a document library in the SharePoint site. follow the below steps:
- Login on Microsoft 365 admin center > Click on Sharepoint under Admin centers.
- Go to Sites > Active Sites.
- Find your site under Site Name Column and click on URL under URL column to launch the site.
- Click on New > Document Library while on the Site’s Home page.
- Provide a Name of the library. Keep the checkbox ticked for “Show in site navigation” and then click on the Create button to create a Document library in this SharePoint site.
Step 3 – Create Power Automate Flow
Now that we have our SharePoint site and document library set up, we can proceed to create a Power Automate flow to automate the file uploads to this document library via email. Please follow the steps below to create this flow:
- Go to the Sharepoint site called EmailUpload and then Click on the ExternalFilesStore Document library created in the previous step.
- From the Menu bar at the top of the document library, Click on Integrate > Power Automate > See your flows
- This will automatically take you to the https://make.powerautomate.com/flows website, where you can initiate the process of creating a new Power Automate flow. Please follow the steps below to create a new Power Automate Flow.
- Click on + New flow drop down and then select the Automated cloud flow option under Build your own from blank category.
- There will be a pop-up for Building an automated cloud flow. Provide a relevant Flow name and choose your flow’s trigger as “When a new email arrives (V3)”.
- Flow Name: CloudInfraSPO-FileUpload-viaEmail
- Flow’s trigger: When a new email arrives (V3)
- Click Create.
- A flow will be generated, and you’ll see a trigger form with a list of options. You’ll need to fill out this form with the necessary information according to your specific requirements.
- Folder: By default, the “Inbox” option will be selected, but you can click the folder icon to choose any other folder if needed. The cloud flow will trigger only when emails arrive in the specific folder you select. For now, we’ll keep it as the default “Inbox.”
- To: Automated cloud flow will trigger when emails are sent to this email address.
- CC: Automated cloud flow will trigger based on the CC email address.
- To or CC: Automated cloud flow will trigger if the email address specified is either in the To or CC field.
- From: Automated cloud flow will trigger based on the sender’s email address.
- Include Attachments: Select Yes to include attachment content bytes instead of null as we are going to use Sharepoint Create file action later to pull the content of the attachment. Keeping it at No will result in 400 Bad request error.
- Subject Filter – Automated cloud flow will trigger if the words provided in this field match with any of the words in the email subject.
- Importance – Automated cloud flow will trigger based on the importance of the Email. For example: Low, Normal, or High Priority emails.
- Only with Attachments – If it’s set to Yes, Automated cloud flow will trigger only if the email contains an attachment
- Click on + New Step to proceed to add a new step in the flow.
- When a new email arrives (V3) trigger form
- Folder: Inbox
- To: Jatin.email@example.com
- Include Attachments: Yes
- Importance: Any
- Only with Attachments: Yes
- Choose an operation: Sharepoint
- Find Create file Action from the list of available Sharepoint actions.
- In the “Site Address” field, click on the drop-down to select the SharePoint site where the documents will be uploaded. If you don’t see the desired site in the list, ensure that you have the necessary permissions to access that site. Alternatively, you can click “Enter custom value” to manually input the Site address if it’s not listed in the options.
- Click on the folder icon within the “Folder Path” text field to choose the Document Library where the files will be uploaded. In this case, since we created the “ExternalFilesStore” document library, select this folder as the destination.
- In the “File Name” field, click on it and then search for “Attachments Name” under the Dynamic content tab. Click on it to add it under the File Name field.
- Select the “File Content” field, then search for “Attachment Content” under the Dynamic content tab. Click on “Attachment Content” to provide this value in the “File Content” field. This step links the content of the email attachments to the File Content field in your flow.
- Here’s the final Power Automate Flow with all the specified values. In the next steps, we will test this flow to observe when it triggers and to verify if it successfully creates and uploads email attachments to the SharePoint site document library, “ExternalFilesStore“. Don’t forget to click the “Save” button to save the flow before proceeding.
Step 4 – Testing Power Automate Flow
Now, let’s test this Power Automate Flow. Please follow the steps below to initiate the test:
- While you’re in the edit mode of the flow, locate the “Test” button in the top right-hand corner. Click on it, then choose “Manually” and finally, click “Test” to manually initiate the test for the flow.
- After clicking the “Test” button, the flow will begin. You can now activate the trigger by sending an email to the email address specified in the “When a new email arrives (V3)” form, which, in our Example is firstname.lastname@example.org. Consequently, you should send an email to this address with an attachment to initiate the test.
“Please ensure that the email is sent from the ‘Sender‘ address listed in the ‘From‘ field of the Power Automate flow. Example: ‘email@example.com.’
- When the recipient receives this email with an attachment in their Inbox folder, the Power Automate cloud flow we’ve set up will be triggered. You’ll be able to confirm this in real time, and once the test is complete, the results of the flow testing will be displayed on the screen.
- You’ll notice a message that says ‘Your flow ran successfully‘ and a green checkmark next to each flow operation.”
- Let’s verify whether the file we sent as an email attachment has been successfully uploaded to the SharePoint document library ‘ExternalFilesStore.’ As shown in the screenshot below, the ‘testdoc.docx’ file has been uploaded successfully into the ‘ExternalFilesStore’.
In this blog post, we’ve explored the process of uploading documents to a specific SharePoint library by simply sending an email with an attachment. While there are several steps involved, the effort pays off when everything functions smoothly.
This approach not only saves time, especially when dealing with external vendors who share files via email but it can also be customized to meet your specific needs. For instance, you can incorporate additional steps like sending a notification on Slack or getting someone’s approval for the file upload process through Slack or Microsoft Teams.
- Connect-SPOService : Current Site Is Not A Tenant Administration Site
- How To Assign Custom Security Attributes Using Powershell
- How To Setup Calendar Sharing Between Office 365 Tenants
- Block Emails Based On File Attachment Extension In Office 365
- Audit Report Of Emails With Specific File Attachment Extension In Microsoft 365