If you want to send a customized email when a new file is added to the SharePoint list, check out this complete Power Automate tutorial. Here, I have explained how to use the “when a new file is added action” in Power Automate Flow.
Scenario:
Recently I got a requirement to send a customized email when a new file is added to the SharePoint document library. I will show you here two different Examples.
In the first example, I’ll explain how to automatically send a customized email when a file is added to the document library without using any prebuilt template.
In the second example, I will show you how to send a customized email when a file is added to the document library by using the prebuilt template called (Send a customized email when a new file is added).
Before creating a flow, we have to create a SharePoint Online document library. Here, I have created a document library called EmployeeDocuments.
We will create a flow to send a customized email when a new file is added to the SharePoint document library using Power Automate.
How to Send a customized email when a new file is added using Power Automate
Let us see how to send a customized email when a new file is added using Power Automate flow.
Example -1:(Without Using Prebuilt Template)
In this example, The flow triggers automatically when a new file is added to the SharePoint library, and the user will be notified with a customized email. To achieve this, follow the below steps:
Step-1:
Create an automated cloud flow and choose the trigger “When a file is created (properties only)” for SharePoint from the action trigger.
Expand the trigger action and configure the required parameters:
- Site Address – From the dropdown, select the SharePoint site address
- Library Name – Select the SharePoint document library from the dropdown (here, I have selected my Employee Documents Library)
- Folder – Choose the Folder from the show picker where you want to check whether the file is added.
Step-2:
Select +new step and send an email(v2) action from the action triggers. Pass the required parameters from the dynamic content values.
- To: Enter the employee email name (email address) from dynamic content
- Subject: Enter a subject line for Mail (here I have added Document Added Successfully)
- Body: Enter the body of the email. Then, enable the code view, add HTML code, pass the values from dynamic content, and customize the mail as per requirement.
<p>Hi @{triggerOutputs()?['body/Author/DisplayName']},<br>
<br>
This Mail is to infrom you that your Document called <b> @{triggerOutputs()?['body/{FilenameWithExtension}']} </b>has been added successfully to the SharePoint Document Library.<br>
Please follow the link to verify the document added: <b><a href=' @{triggerOutputs()?['body/{Link}']}'>click here</a></b><br>
<br>
Thanks,<br>
SharePoint Team</p>
Step-3:
Run the flow. The flow triggers automatically when a new file is added to the SharePoint document library.
Here, I have added a new file called Patti Fernandez in the SharePoint Employee Documents library, as highlighted below:
Once the flow triggers automatically and runs successfully, A Customized email will be sent to the user in their Outlook.
This is how to Send a customized email when a new file is added using Power Automate flow.
Example -2: (By Using Prebuilt Template)
In this example, I will show you how we can send a customized email when a file is added to the document library by using the prebuilt template called “Send a customized email when a new file is added“.
Step-1:
Log in to Power Automate flow using the credentials, and Select Templates from the left navigation.
Then search and choose Send a customized email when a new file is added template provided by Microsoft as highlighted below:
Step-2:
- A new page will appear like the one below with the selected “Send a customized email when a new file is added” template.
- The flow automatically connects to Office 365 users, office 365 Outlook, and SharePoint. The Green tick mark displays the valid connection. If it is not connected, connect it first.
- Once the connection is valid, Click on the Continue option.
Step-3:
It creates a flow for us, once the flow has been created. Expand the When a file is created (properties only) trigger. Configure the below Parameters.
- Site Address – From the dropdown, select the SharePoint site address
- Library Name – Select the SharePoint document library from the dropdown (here, I have selected my Employee Documents Library)
- Folder – Choose the Folder from the show picker, where you want to check whether the file is added or not.
In the Get my Profile (V2) action, pass the created by Email from the dynamic content values
By default, The Send a customized email when a new file is added provides the send email action with the below details:
Step-4:
Run the flow. The flow triggers automatically when a new file is added to the SharePoint document library.
Here, I have added a new file called Alex Wiber in the SharePoint Employee Documents library, as highlighted below:
Once the flow triggers automatically and runs successfully, an email with the default mail body is sent to the user.
So, here I am going to change or customize the default mail body with the HTML code given by the Pre-built template as below:
Hi @{outputs('Get_my_profile_(V2)')?['body/givenName']},<br><br>
This Mail is to infrom you that the Document called <b>@{triggerOutputs()?['body/{FilenameWithExtension}']}</b> has been added successfully to the SharePoint Document Library.
Please follow the link to verify the document added: <b><a href ='@{triggerOutputs()?['body/{Link}']}'>click here</a></b><br>
Thanks,<br>
SharePoint Team
Again, I am going to add a new file called Lynne Robbins to the SharePoint document library as shown below:
Once the flow triggers automatically and runs successfully, A Customized email will be sent to the user in their Outlook.
This is how to Send a customized email when a new file is added by using the Power Automate Template flow.
Conclusion
I hope you got an idea of how to Send a customized email when a new file is added to the SharePoint document Library without using any Prebuilt templates.
Similarly, I have shown you how to work and customize the default mail body for the Send a customized email when a new file is added Template flow in Power Automate.
You may also like:
- How to Convert a String to an Integer in Power Automate?
- How to Convert String to GUID in Power Automate?
- Get File Content using Path in Power Automate
- How to Populate a Word Template using Power Automate?
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com
Is this a free flow with E3 licensev?