Microsoft Flow, linking email to SharePoint List items


Using SharePoint and Microsoft Flow, I built a system for sending emails to external people and then processing the replies, including extracting attachments and linking back to the original SharePoint List Item.

Here’s the process:

  • User creates a new List Item with the email address of an external person (can be internal also)
  • Using Flow, send an email to the external person’s email address:
    • Subject line includes a reference number (the list ID value for the new list item)
    • Body text including a link to a document the user can download, print and sign (think contract document)
    • Instructions to reply to the same email with the signed document attached
  • A second Flow, monitors the Outlook mailbox (for the user that published the Flow)
    • Extracts attachments
    • Reads the subject line and using a string function to extract the ID value
    • Get the item in the source SharePoint list using the ID to find the source item
    •  Email the approving manager (entered into the SharePoint list item) with a link to the downloaded attachments

The First Flow, runs when a new list item is created in SharePoint. I do one little trick with the Contractor Email Address so the Flow will send to email addresses outside the organisation.

Flow-Send-Email

 

The second Flow, is based on the Flow template for extracting attachments from an inbound email.

The HTTP request creates a folder in the SharePoint Document library and later I save the attachments into the folder. This makes it easy to send a link to all attachments (hint: just send a link to the folder created in this step)

InkedFlow-Create-Folder-Extract-Attachments_LI

This part of the second Flow, reads the subject line and extracts the ID which I included in the first Flow’s email subject line.

First you need to extract the reference from the inbound emails subject line using this function:       last(split(triggerBody()?[‘Subject’],’Ref:’))

StringFunc.PNG

Now convert the Reference number from a String to an Integer and then use it to lookup the item in the source list with the same ID (see Get Item below).

InkedFlow-Send-Email-WithRef_LI

That’s it! So as a quick recap, the user initiates the process by creating an item in a SharePoint List. Flow sends an external email. The recipient adds attachments and replies to the source email. Flow extracts attachments, reads the subject line and pulls out the ID of the source list item. Using Get Item, Flow then reads data from the source list item that initiated the process.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s