Monday, 27 April 2020

Enable incoming mails in SharePoint Online

In SharePoint 2010, 2013 and 2016, When incoming emails are enabled, SharePoint sites can receive and store email messages and attachments in lists and libraries. And this Incoming email feature is available only in SharePoint Server 2016 and earlier versions of SharePoint Server, and this has been deprecated as of SharePoint Server 2019 and SharePoint Online. 

Alternate Solution: 

SharePoint Online does not have email enabled lists like on-prem SharePoint has. We have to use a work around using other Office 365 apps to create a similar functionality. A Office 365 email address has to be added to the To or CC line so the email can be sent to the Office 365 mailbox. The email will be filtered to a sub folder based on certain criteria (e.g. sender). We then use Microsoft Flow to grab the attachment(s) and move them to the desired folder on your SharePoint Online site. 

Microsoft Flow:

We can make use of Power Automate(Flow) to create a simple flow which will read mails from a Shared Mailbox in Exchange Online, get the attached documents and upload those in the SharePoint Online document library. 

Shared Mailbox vs User mailbox: 

Shared Mailbox accounts:
  • Shared mailbox do not require O365 license.
  • These accounts are disabled by default and not designed for direct logon into AD/Azure with no license but mailbox-enabled.
  • This account will not get resolved in SharePoint.

Note: If you are using SharePoint Designer workflow: Check if your workflow was created using 2013 template, If so, please create the same workflow in 2010 template and verify the logic. You will not be able to send an email to Shared mail box account using SPD 2013 template.

User mailbox accounts:
  • We can call it as non-human id mailbox accounts.
  • User mailbox enabled and designed for direct logon into AD/Azure and We should be able to resolve these accounts in SharePoint so that we can grant them access. 

Create a Shared Mailbox: 
  • Create a mail enabled shared mailbox in Office 365 if you have exchange administrator(or Global) permissions if not get it done by exchange administrators.

Reset Password:
Reset password from Office 365 Admin Portal-->Active Users. 

Create Flow:
Now that we have the required mailbox and it’s password in place, lets go ahead and create our flow. 

Go to Microsoft Flow and login with your Office 365 account. This account need not be the same mailbox account.
Click on My flows and then on Create from blank template
Select flow trigger ‘When a new email arrives’ and then create the flow.

Once the connection is added, we need to configure which folder to look into the incoming mails. So, click on the folder icon next to the text box with screen tip as “mail folder to check for new emails” and select Inbox from the menu. You may also want to select Attachment and Include Attachment to Yes to ensure this flow only triggers when the incoming mail has any attached documents.


So now the source is set. Let’s configure SharePoint part. 

Click on New Step, and type ‘Get Email’ from search box. 

Click on Message Id box,  then click on second box (add dynamic content), under dynamic content tab in search box type Message Id which you want to map , then select your column under "When a new Email arrives" section.

Select Include Attachments should be Yes

Click on ‘New Step’, and select ‘Create File’ from search box

Select the Site URL either from drop down or just by typing it in the site URL in Site Address and then the document library in the Folder Path field and click Save Now. 

Click on File Name box,  then click on second box (add dynamic content), under dynamic content tab in search box type ‘attachments name’ which you want to map , then select your column under "Get email" section.

Click on File Content box,  then click on second box (add dynamic content), under dynamic content tab in search box type ‘attachments content’ which you want to map , then select your column under "Get email" section.

Finally add Delete Email action to delete the email from the Office 365 mailbox. 

Click on ‘Add an action’ and select ‘Delete Email ’ action. From the second box (add dynamic content), under dynamic content tab in search box type ‘Message Id’ which you want to map , then select your column under “Get email’ section.

Your Flow should be like this


No comments:

Post a Comment