Microsoft Flow: Copy Email Attachment to OneDrive for Business and Approve Copy to SharePoint

By - April 15, 2019


Microsoft Flow enables the ability to automate tasks across a multitude of business software’s. This is possible using connectors with over 200+ business software’s including Dynamics 365, SharePoint and Twitter. A Flow needs a minimum of two steps with the first being a Trigger followed by Actions. Most connectors have both of these steps. An example of a Trigger for Dynamics 365 would be “when a record is created” or “when a record is deleted”. Once the Trigger fires then an Action must follow. An example of an Action for Dynamics 365 would be to “create a new record” or “list records”.

Use Case

Save Outlook email attachments to OneDrive for Business and approve a copy to SharePoint.

Throughout the day think of how many emails you receive on average. Now think of the amount of time you spend organizing the attachments and inbox. Organization is incredibly important and the use of automation helps reduce the amount of time spent keeping things organized. Think of the time you will save knowing that all of your attachments are automatically saved to OneDrive and only approved attachments will be saved to SharePoint. The following Flow will do just that.

In the screen shot below the Flow is triggering when a new email is received in my Inbox folder of Outlook. Since we can have many attachments per email, I’m using the “Apply to each” Action. This example highlights one of the limitations of Flow. If you have any images in your signature they are recognized by outlook and will also be saved to your OneDrive. As a work around I used the conditional Action to check if the Attachment Name does not start with image. If the logic is true then the “If yes” column is ran otherwise end the Flow.

When the logic of the condition is met then the Flow follows the “If yes” Actions. The first Action is to create a file of the attachment in the specified Folder within OneDrive for Business. You want to use the dynamic content for many of the fields. Below I am pulling the Attachment Name and Attachment Content from Outlook to use as the file name and file content for the file created in OneDrive for Business.

The screen shot below shows the folder named “Email attachments from Flow” within OneDrive for Business and the files that are now stored there.

The screen shot below shows the approval email. You also have the option to add a comment when you approve or reject an approval request.

The following screen shot shows the details of each of the Actions within the “If yes” column. Both the OneDrive for Business and Approval Actions were successful. Depending whether or not the approval request was approved or rejected will determine if the SharePoint Action will trigger or not.

When the approval requested is approved it will continue to the SharePoint Create file Action. This will create a copy of the approved OneDrive for Business files within a specified location of SharePoint. The screen shot below shows just that.

This particular Flow can be customized to only trigger from a specific person or with an Importance level of high, normal, low or any. This can also be used for individual use or team use on projects. Additionally, you can create multiple check conditions to determine which folder within OneDrive and SharePoint you’d like the attachments to be saved to.

Receive Posts by Email

Subscribe and receive notifications of new posts by email.