Recently working on one of the SharePoint-based project, one of the requirement was to process incoming emails in SharePoint Online (Office 365). In other words, the incoming email needs to be saved in a SharePoint List or Library along with its metadata and attachments. So, I decided to use Azure Logic Apps approach wherein the email (.eml file) can be saved along with its attachments and other metadata in SharePoint List & Library.
- In SharePoint on premise, there are email enabled Lists/Libraries and you can also configure incoming email settings in Central Administration, however in SharePoint Online, there is no as such direct way to process incoming emails, so you need to implement other alternatives like Logic Apps etc.
- Earlier, you can use Site Mailbox, however SharePoint Online deprecated Site Mailbox feature as of July 2017.
- Office 365 Groups could be other alternative which are created at the tenant level.
- Power Automate (Microsoft Flow) can also be considered as one of the alternative.
- Outlook treats inline images as attachments so those will be saved as attachments to the SharePoint list item.
- Utilize the Outlook Action “Export Email” to capture the body content of the Email.
In this article, I will explain how you can use Azure Logic Apps to save the incoming email, metadata (From, To, CC, Subject, and Body etc.) and attachments in a SharePoint Online List & Library, so let’s get started!
- An Azure subscription
- An email account from an email provider supported by Logic Apps, such as Office 365 Outlook, Outlook.com, or Gmail.
Create your logic app
- After the Logic Apps Designer opens, under Templates, select Blank Logic App.
- On the designer in the search box, enter when new email arrives as your filter. Select this trigger for your email provider.
If you’re asked for credentials, sign in to your email account so Logic Apps can connect to your email account.
- Under the trigger, select new step. In the search box, enter condition. Create a condition that checks for emails that have attachments.
- The above condition will check if the incoming email has attachments. If it’s true, then Logic App will save the email in a SharePoint Library and will save the attachments and email metadata in a SharePoint List.
- Below are the settings of individual actions used in Logic Apps: –
Below are the settings for the action to get an individual attachment: –
Below are the settings for the action to save the email attachment as an attachment to the SharePoint list item: –
Test the Logic App
- Save your Logic App and click on Run on the designer toolbar.
- Send an email that has attachments. When the email arrives, your logic app checks for attachments. If the condition passes, the trigger fires and causes the Logic Apps engine to create a logic app instance and start the workflow.
- Below is the result of one of the instance run of Logic Apps when an incoming email is received: –
- The email (.eml file) is saved in a SharePoint Document Library: –
- The email metadata along with attachment is saved in a SharePoint List: –
In this article, I have explained how you can use Azure Logic Apps to process incoming emails in SharePoint Online and can save the email, its metadata and its attachments in a SharePoint List.
Sharing is Caring!