cancel
Showing results for 
Search instead for 
Did you mean: 
themsenduser

Use Flow To Organize and Process Email Attachments

Ok, here's a post to piggy-back off of my post regarding inbox sweep rules!

 

A common scenario for many organizations and users is the need to organize images or documents that are sent from external sources.

 

How can you organize a bunch of images that someone is sending you from an event without having to train someone to use a new app and login to Office 365?

 

How do you take that document that a user sent you, get it into SharePoint or Teams with the proper metadata/properties?

 

The answer is this quick and easy Flow, which will allow you categorize and move attachments into Document Libraries and add identifying metadata as part of the process. Using the sweep rules in an email inbox, you can manage and sort the emails and attachments in one simple process, and also use sweep rules to clean up the emails as they get stale if you so desire. By using Sweep Rules in combination with folders in Outlook and Document Libraries in SharePoint or (/Office365 Groups or Microsoft Teams), you can be very specific as to how attachments can be sorted and labeled as part of this process.

 

For event images for instance, the filter can be based on the hashtag for the event, or for any use case you can simply use a unique character string. I always recommend using a symbol of some kind like an _ or * or ^, like if someone includes ^contract in the subject the attachment will be routed to the Contract library with the email body text in the description column. Remember for any email you can always pull the address of the sender as well as the time stamp via Flow to add more information to the destination library.

 

The only caveats to this is that for Flow to work, the attachments cannot be inserted inline with the email, they must be actual file attachments to the message- and you need to use a Document Library as opposed to a list.

 

OK, let's get started!

First, make your folders and setup your Sweep Rules as desired.

 

Image 001.png

 

Here, I've created a folder for marketing images, to receive images from people at events for our marketing team. When this email box gets an email with #image in the subject, it will send that email to the Marketing Images folder to trigger my Flow (see below).

Image 002.png

Next, setup your destination Document Library or Libraries and metadata columns.

 

For my Document Library, I've set up columns to keep track of the images that are sent.

Image 011.png

The column values for each image will be pulled from the email itself- it's important that users understand the conventions you set to make this work properly- having a specific hashtag for an event that goes in the subject in this instance would be a good way to keep track of things. For this example, I'll use #Image #Ignite2018

 

For my Microsoft Team attached to this group, I'm going to add a channel tab for this library too, so it's easy for people to see the new images and control notifications about them as well.

 

Image 003.pngImage 004.pngImage 005.png

 

Now, it's time to get into Flow and make the magic happen!

 

I'll start with the trigger in Outlook, "When a new email arrives" and choose the "Marketing Images" folder I made with my sweep rules. It's very important to also set the "Include Attachments" Option to "Yes" Then I'll need to use the "Get Attachment" action, so I can isolate the email attachments. It's important to note again here, that this will only work with actual message attachments, not images that are put inline into an email.

Image 007.png

 

Flow will add the "Apply to each" container around this action to capture all the attachments in a given email.

  

Set the flow to create a new file in a Document library based on the criteria you've chosen- and use email data to add metadata to the columns in your library.

Image 012.png

Now test your Flow!

 

Image 013.png

...and here it is in Teams!

teams.jpg

Well, I'm really excited for when Teams finally has all the metadata display capabilities of SharePoint, which has been conifirmed as being the intention of MS-but in any case...

 

SUCCESS!

 

When I send an email with attachments that has #image #Ignite2018 in the subject, the email is routed to the proper folder, and the information within the email is added to the images that show up in the Document Library. I can also now easily see and interact with those images in Teams, because I added the library as a channel tab to my Marketing Team. When testing this, I also discovered that it can be tricky to try and use the body content of an email for Metadata, as Flow will attempt to pull all the HTML from the message- so basically don't do this. Just pull the information from the Subject line for your file sets, and make sure that your teams are properly educated on naming conventions! I personally have used this for the same use case above, and also to record check deposits along with the customer name and subject for each check.

 

It's also easy to update the Document Library as time goes on if you need to organize or clean up your data in the future. 

 

Remember this can be so much more than just images- it really can work with any email attachments. Also, you can make many Flows based on different folders within an Exchange mailbox, and this will work with all the attachments witinin an email- which means that you can really mitigate how many Flows are kicked off. 

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/