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.
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).
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.
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.
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.
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.
Now test your Flow!
...and here it is in Teams!
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.