Flow: File Emails in SharePoint with Metadata
Have you ever had the need to file e-mails to a site in SharePoint and would like to bring across the metadata from outlook, so it can be searched from right inside SharePoint?
This requirement would usually lead you to the path of purchasing a third-party solution such as OnePlaceMail.
These third-party solutions are fantastic and highly configurable, but if you have a once off use case you may be able to get away out of the box with Office 365 and Microsoft Flow.
Step 1) Setup a SharePoint Content Type
In this example I have created a e-mail content type as illustrated below:
You can get to the content type creation page from inside your site at the following URL:
<<your sharepoint site>>/_layouts/15/ctypenew.aspx
Step 2) Setup Outlook
For ease of use I have setup a sub-folder in the Inbox as so:
The top-level folder will be used to move any mail I would like filed to SharePoint. The processed folder is the final destination that Flow will move the e-mails to once it is done, this is to ensure it does not re-process the same e-mails over and over.
Step 3) Creating the Flow
As there is no way to trigger the flow when you move items into a folder at the time of writing. This will be achieved by setting the flow to run on a recurrence. For testing this was set to every 60 minutes. You may wish to set shorter or longer recurrences depending on how frequently you are storing e-mail.
The flow in its entirety can be seen here:
As mentioned earlier the flow is set to run every 60 minutes to check the outlook folder we created earlier.
Once the flow is started, we must first get the emails from the folder that was created earlier with a Get Emails step:
I have increased the Top variable from 10 to 20 to ensure more e-mails are processed each time the flow runs.
The next step of the flow is Convert time zone this was added towards the end of testing as the meta-data for received time was not displaying correctly. This does need more testing but is an easy action to configure:
The next two steps export the message from Exchange and create the file in SharePoint.
We are then using the Update file properties step to set the metadata for the Email Content Type we defined in step 1.
Finally, the we move the email to the processed folder so we do not run the risk of errors or duplicates stored in SharePoint
The end result will look something like this:
If you would like help constructing some flows of your own get in touch with the KKiT team today email@example.com