Use Microsoft Flow to Notify of New Files in a Folder - Excelerator BI

Use Microsoft Flow to Notify of New Files in a Folder

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).

Flow Dynamic

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.

12 thoughts on “Use Microsoft Flow to Notify of New Files in a Folder”

  1. Very cool, thank you for posting! How would you do this if instead of wanting to send a new notification every time a file got created, you wanted to schedule the flow to “check” for new files three times a day let’s say, (8 am, 12 pm, 4 pm as an example) and IF there is a new file there, then send the notification? If no new file, then take no action.
    Thanks!

    1. You would have to look into it Amy, but I am sure it can be done. Every flow is triggered by an event. My event is the arrival of a file, but you could change the trigger to be time of day. It seems like a pretty simple change with the rest being the same (albeit a double trigger – but I don’t see that being an issue).

  2. This is all great and easy to set up for an individual file. But, I have a situation where hundreds of files are put into a folder on an employees computer. What I want to do is have the folder copied into a Sharepoint document library and receive an automatic email when the FOLDER is copied into Sharepoint. Right now, I’ve only figured out how to do it by file which is bad when you have say 2,000 files in a folder. So how can I get 1 email alert just for the folder?

    Thanks!

  3. Genevieve Van Buhler

    Is there a way if someone is uploading multiple documents at a time to the folder to only get one email notification?

  4. Yes, I was going to say the same about Alerts in sharepoint when I read the comments but I totally agree with Matt about start learning MS Flow. When we see all available connectors and templates, we start thinking about how many things we could automate with Flow. Even more possibilities when integrating with PowerApps.

  5. Hi Matt, SharePoint has built-in functionality to send emails when new items are added/changed in a library or folder (or a list). It’s been around for ages (at least WSS 3 = 2007). The message is somewhat ugly and Flow gives you better tools to control the look and feel and content of the message, though, but when you have a moment check out the “Alert me” command in any SharePoint list or library (hidden behind the three dots). It is folder-aware, so you can get alerts only for a specific folder, if you want.

    1. Thanks for sharing – I didn’t know that. The purpose of my post however was to start the journey of learning Microsoft Flow. Starting simply is a great way to learn.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top