Power Automate is an RPA solution from Microsoft which is also part of the Power Platform. Microsoft Power Platform is a group of products i.e Power BI, Power Apps, Power Virtual Agent, and Power Automate.
Microsoft Power Automate was earlier known as Microsoft Flow. Using power automate, a large number of business automation tasks can be performed. A large number of applications can be integrated and the process can be easily automated.
So, In this article, We will see How to send an email alert when a new PDF file gets created in the SharePoint folder?
Step 1: Create a New Site in Sharepoint. You can also use the existing site and its folder but here I am creating a new site for beginners.
Step 2: You will get the option to select the type of site which you want to create. Select Team site.
Step3: Enter the site name and description of the site. Here, We have kept the site name as hello world1
Step4: Once your site is created, click on Documents.
Step5: In the Document Folder, whenever a pdf file is added into the document folder then an email will be delivered to the email mentioned in the power automate.
The above steps are required to be done if anyone does not have a SharePoint team site. So when your document folder is ready then we can proceed with further steps.
Step1: Go to Power Automate and click on the Create button. Once you click on the create button, you will get options to select the type of flow which you want to create. You have to select Automate flow.
When you use Automated Flow, Flow will look for the triggering event and once it gets the triggering event flow starts running.
In the case of Instant Flow, the flow gets triggered when a button is pressed on the app.
In the case of scheduled flow, you get an option to schedule the trigger at a specific time.
Step2: Give the Name to your flow in the Flow name section and also select the flow trigger as “When a file is created in a folder”.
Step3: You have to enter the Site Adress and Folder id as per the below screen.
Step4: Click on the New step and then search for Variable and then select the option Initialize Variable.
Step5: In the initialize variable box, enter the variable name and its type and value which we want to assign to the variable. So, here we have kept the variable type as a string because we want to store the filename in the variable. when you click in the box for value dynamic content option will popup which will give you an option to get details from SharePoint. Here, we have stored the filename from SharePoint into the variable.
Step6: Next we have to insert the Condition Box.
Step7: Once you click on the condition, you will option to insert your condition that if the filename ends with pdf then send mail else to do nothing. In the condition box, make sure that the variable is used in the condition if you choose dynamic content filename then floe will not work correctly.
Step8: Now, we have to add the email details in the “If yes” Box. Click on Add an action, type send mail in the search box, and click on action send an email (V2) Office 365 outlook.
Step9: Once you click on Send an email (V2), you will get To, Subject, Body boxes where you can add the details.
Step10: Save and check the flow using Flow Checker available in the top right corner of the Window.
Once you click on Flow Checker then it will show any error present in the flow and at which step. So it’s pretty easy to find the error in your flow.
Step11: Now we have to check whether the flow is working on not. Use the Test option available in the top right corner. Once you click on it, you have to select the trigger action.
So if this is the first time you are checking the flow then you have to select ” I`will perform the trigger action”. In order to test the flow, we can place a pdf file in the SharePoint folder and then check the email mentioned in the To section. With this flow runs and you can also check the result from each of the boxes.
you can see that in the value we are able to see the file name which was placed in the document folder in SharePoint.
Similarly, we can check the Condition box to see its result whether is true or false. In our case it’s true means the condition that the filename should end with pdf is satisfied.
and if you have already placed the file previously and checked the flow and again want to test after making some changes then you can choose the second option “Using data from previous runs”. It gives you an option to select which data from which run you want to take.
In this case, as well, you can check the output of each box.
Step 12: Run the flow. Since this flow is automated so the flow will run based on the triggering event.
Here in the example, the triggering event is the presence of a pdf file in the SharePoint folder.
So in order to run the flow, we have to place the pdf file in the folder and then check whether flow runs or not by clicking on my flow >> select the flow>> then check 28 days run history
Also, you can check your mail to see if you have received the mail or not.
This is a great exercise to start with Power Automate. Practice it on your own so that get hands-on experience in power automate. Let me know in the comment if you have any face issues in practicing this flow on your own.
Founder of Power BI Talks. An Experienced Software Professional working with Global MNC. I write articles on technical products such as Power BI, Azure, Python, etc.