Process Incoming Emails In SharePoint Online Using Azure Logic Apps

Introduction

 
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 the Azure Logic Apps approach, wherein the email (.eml file) can be saved along with its attachments and other metadata in SharePoint List & Library.
 
Note
  • 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 another alternative that is created at the tenant level.
  • Power Automate (Microsoft Flow) can also be considered as one of the alternatives.
  • 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!
 
Prerequisites
  • 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

  1. After the Logic Apps Designer opens, under Templates, select Blank Logic App.
  2. On the designer in the search box, enter when a new email arrives as your filter. Select this trigger for your email provider.

    Process Incoming Emails in SharePoint Online using Azure Logic Apps

    If you're asked for credentials, sign in to your email account so Logic Apps can connect to your email account.
  1. Under the trigger, select new step. In the search box, enter condition. Create a condition that checks for emails that have attachments.

    Process Incoming Emails in SharePoint Online using Azure Logic Apps
  1. 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.

    Process Incoming Emails in SharePoint Online using Azure Logic Apps
  1. Below are the settings of individual actions used in Logic Apps

    Process Incoming Emails in SharePoint Online using Azure Logic Apps

    Process Incoming Emails in SharePoint Online using Azure Logic Apps

    Process Incoming Emails in SharePoint Online using Azure Logic Apps

    Process Incoming Emails in SharePoint Online using Azure Logic Apps
Below are the settings for the action to get an individual attachment:
 
Process Incoming Emails in SharePoint Online using Azure Logic Apps
 
Below are the settings for the action to save the email attachment as an attachment to the SharePoint list item:
 
Process Incoming Emails in SharePoint Online using Azure Logic Apps
 

Test the Logic App

  1. Save your Logic App and click on Run on the designer toolbar.

    Process Incoming Emails in SharePoint Online using Azure Logic Apps
  1. 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.
  2. Below is the result of one of the instance run of Logic Apps when an incoming email is received:

    Process Incoming Emails in SharePoint Online using Azure Logic Apps
  1. The email (.eml file) is saved in a SharePoint Document Library:

    Process Incoming Emails in SharePoint Online using Azure Logic Apps
  1. The email metadata along with attachment is saved in a SharePoint List:

    Process Incoming Emails in SharePoint Online using Azure Logic Apps
Reference Links
  • https://docs.microsoft.com/en-us/archive/blogs/svarukala/sharepoint-online-incoming-email-alternatives
  • https://docs.microsoft.com/en-us/azure/logic-apps/tutorial-process-email-attachments-workflow

Summary

 
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!