Last week I attended Summit Australia in Melbourne. Summit Australia is a conference that focuses on the same products as the larger Microsoft Business Applications Summit (held this year in Atlanta). The majority of delegates visiting the Summit this year were interested in Microsoft Dynamics, but there was also a core group that was focused on the Power Platform (Power BI, Power Apps and Flow). I attended lots of sessions and presented a couple myself. I took the opportunity to sit in on a number of Microsoft Flow sessions, notably sessions by Farid Jalal and John Liu. I have always been interested in the potential of Flow. Like many of the new products, there is only so much time in the day to learn something new and a conference like this is a great place to learn. Inspired by what I learnt, I decided to implement my first business focused Flow for my company. My blog today will show you how to do it too, and how easy it is. Note: As mentioned belown the comments, it is possible to do this using standard SharePoint features, but this article is about starting the journey to learn Flow.
Monitor a Folder for New Files, then Send an Email
I have a process in my business where Ramana produces invoices for the company each month, and then places them in a folder for me to review. When I have reviewed the invoices, I move them into a folder “approved to send”. The creation, review and approval processes are all manual (fine for a small business). But there are 2 manual processes that can be automated with Flow, and that is the notification that there is a file in the folder ready for action.
Steps to Monitor Folder
The folder in use in this case is a OneDrive shared folder replicated to my PC. This type of folder is technically a SharePoint offline document library (don’t get me started on that!). It is what it is, so I had to set the Flow trigger up on a SharePoint folder.
Log into http://flow.microsoft.com then select Create a new flow (1 below).
You can start a flow from blank or there is an option to start a Flow from a template. See below.
When you are starting out, I recommend you try to find a template that is close to your needs. There are lots of moving parts and these templates can help you get it right, plus you can learn from the way they are configured.
I searched for “sharepoint file email” to find a suitable template (see below)
The first template that came up looks like a good candidate “Send a customized email when a new file is added“.
When I clicked through – bingo.
There were quite a few settings that I could see, but I just clicked continue.
Now, note in the image below all the pre-configurations that have been done already. In the top SharePoint box, I have to configure the folder names myself. In the Office section “Get my profile” that all just seemed to work. And in the email box at the bottom, there was a lot of pre-configuration out of the box – easy!
To configure the SharePoint folder, all I had to do was navigate the menu options in the drop down boxes shown below.
I clicked save and ran a test. To test it out, all I did was add a text file to the folder and then waited a few seconds. This email arrived in my inbox.
Note the hyperlink above. This is the link code shown below.
https://exceleratorbi.sharepoint.com/Shared Documents/Finances/Invoices/ 1. Invoices Ready to Review/New Text Document.txt
This link points to my online SharePoint folder. I wish Microsoft would allow me to interact with files locally, just like DropBox. I then wanted to change the link so that it pointed to my local replicated version of the folder. I had a go at doing this, but I wasn’t really sure how to do it. I asked John Liu for help, and he guided me through the options. Actually, as it turned out, all I really needed for this flow was a static link to the folder. I went back to the flow and looked at the last step “Send an Email”.
Notice in the image above that there are certain dynamic items that are automatically added to the email, including the file name, a link to the item etc. I decided to edit the email as shown below. When I clicked in the email body (1 below), a list of insertable features appeared on the right (2 below).
I found the folder path in the list (3 above). I simply added this to the email, saved, and did another test.
This is what I got.
Actually, this is the path to the SharePoint folder. Given I am only monitoring a single folder here, I decided just to hard code the link to the folder on my PC. I want to open the folder when a file is added in this case, not the file. So I added a hard coded path to my folder as shown below.
And that’s it. Now every time a new file is added to this folder, I get an automated email with a local link to the folder – sweet.