Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article, we will see how we can utilize Microsoft Flows to copy email attachments from Outlook Emails to SharePoint Document Library.
To continue with this demo we can start with adding a document library to SharePoint site, let’s call it “Outlook Attachments”
https://howtodowithsharepoint.files.wordpress.com/2017/08/1.png?w=800
Now go to Microsoft Flow designer and start with adding a workflow
As explained in earlier articles, we need to start with selecting a trigger for this workflow
Since we need to copy the email attachments to document library so we have two cloud services “Office 365 Outlook” and “SharePoint Online” to deal with
Select “Office 365 Outlook” as connector and “Office 365 Outlook – When a new email arrives” as trigger to kick off this workflow
https://howtodowithsharepoint.files.wordpress.com/2017/08/2.png?w=800
Choose the Outlook folder or subfolder that you want to monitor. Here we are selecting “Inbox” as target folder. This means workflow will trigger only if the email arrives in Inbox folder and rest of the emails will be ignored.
https://howtodowithsharepoint.files.wordpress.com/2017/08/3.png?w=800
Set “Has Attachment” = Yes. This setting will further filter out the incoming emails based on if they have attachments or not.
We are only monitoring only emails with attachments and that’s what these filter will achieve for us.
Set “Include Attachments” = Yes. This is required so that Workflow runtime include the binary information of each the attachments and make it available to be written to SharePoint Library.
https://howtodowithsharepoint.files.wordpress.com/2017/08/4.png?w=800
Add another action with “SharePoint” as connector
Select “SharePoint – Create file” as trigger. This action will be responsible to write down the attachment binaries to SharePoint Library
https://howtodowithsharepoint.files.wordpress.com/2017/08/5.png?w=800
Enter Site URL where we have “Outlook Attachments” document library sitting
Select document library name from the lookup in the Folder Path field
https://howtodowithsharepoint.files.wordpress.com/2017/08/6.png?w=800
Select “Name” property in the File Name field, this property represents the name of the attachment
https://howtodowithsharepoint.files.wordpress.com/2017/08/7.png?w=800
Select “Content” in the File Content Field, this property will hold the binary data for the attachment being written to the SharePoint Document Libraries.
Here it is important to note that if we do not set the “Include Attachments” = Yes, then Content property will be null and will cause not write operations takes place
https://howtodowithsharepoint.files.wordpress.com/2017/08/8.png?w=800
Add another action to the workflow, which will be responsible to send email after the attachment has been copied to the SharePoint Library
https://howtodowithsharepoint.files.wordpress.com/2017/08/9.png?w=800
Select “Office 365 Outlook” as connector
Select “Office 365 Outlook – Send an email” as trigger, this trigger is responsible for sending emails
https://howtodowithsharepoint.files.wordpress.com/2017/08/10.png?w=800
Choose or any valid email id in “To”, here we are just selecting the author's email
Specify Subject as applicable
Specify the Body content as required. This content can consist of dynamic tokens provided by Workflow runtime as shown below
https://howtodowithsharepoint.files.wordpress.com/2017/08/11.png?w=800
Save the Workflow and complete it.
In the following screens, we can see the complete workflow steps in one go
Step-1
https://howtodowithsharepoint.files.wordpress.com/2017/08/12.png?w=800
Step-2
https://howtodowithsharepoint.files.wordpress.com/2017/08/13.png?w=800
Step-3
https://howtodowithsharepoint.files.wordpress.com/2017/08/14.png?w=800
Now let’s test the workflow by sending an email with attachments to myself.
https://howtodowithsharepoint.files.wordpress.com/2017/08/15.png?w=800
Once the email containing attachments in Inbox Folder is received, Workflow gets triggered
https://howtodowithsharepoint.files.wordpress.com/2017/08/16.png?w=800
Just after that we can see workflow entered into the debug mode as shown below
https://howtodowithsharepoint.files.wordpress.com/2017/08/17.png?w=800
And as soon as it is completed we can see the completion notification email as shown below
https://howtodowithsharepoint.files.wordpress.com/2017/08/18.png?w=800
And we can also see the attachments copied to the “Outlook Attachments” SharePoint Library as shown below
https://howtodowithsharepoint.files.wordpress.com/2017/08/19.png?w=800
Hope you find it helpful.