Friday, October 13, 2017

Using Flow to promote better document sharing and collaboration in your organization

During lunch today I mentioned a customer sending me a document attachment in an e-mail, instead of what clearly should have been a sharing link to the file.

Outlook has excellent capabilities for sending sharing links instead of attachments, and especially internally in organization this should be the preferred approach to avoid e-mail bloat and multiple versions of the truth. Forcing people to change is not easy, but the conversation let to the following Flow urging your colleagues to do the right thing :)

image

First create a new Flow which triggers on When a new email arrives, and match if it has attachments and choose to include the attachments as well.

image

Next we need to check the attachments. This complicates things a bit as inline smileys, signature logo’s etc. are included as attachments.

A solution is to loop over all attachments, and ignore the e-mail if the attachments are all images. It’s not 100%, but will trigger for all other file types.

First we need to initialize a boolean variable (Has Attachment) to hold the value if we have unwanted attachments or not.

image

Next add an Apply to each element step and pass in Attachments from the e-mail as the collection to loop over. If the Content-Type of the attachment does not contain the word image, we set the variable to true.

image

Next add a condition with a formula to checks that the sender is in your organization and that the e-mail has non-image attachments. Add any other filter as you see fit.

@and(contains(triggerBody()?['From'],'yourdomain.com'),equals(variables('Has Attachment'),true))

image

If the condition matches, send off an automatic reply to help your colleague improve on his or hers collaboration skills. To get the message id, you need to click the see more link for dynamic content.

image

If all goes well, your attachment loving colleagues will have a change of heart and do the right thing!

A big thanks to Tarjei for triggering the idea to this post.

The complete Flow

image