In this Power Automate tutorial, we will learn how to send an email with an attachment from SharePoint using Microsoft Flow.
So here we will create a Microsoft flow that will send an email to the recipient with the attachment. Let us check out an example on Power Automate send an email with an attachment from SharePoint.
Here we will see how to send an email with an attachment to the recipient from SharePoint using Power automate or Microsoft flow.
I have created a Project management list in SharePoint and when a manager creates a new project/item and assigns it to the user with an attached document.
According to the Assigned to field value that person will get an email with all the attachments.
For example, if the XYZ project is assigned to user1, then user 1 will get all the attachments of that project.
Here we will see what are the steps to send an email with an attachment from SharePoint using Power automate.
Step 1: Create a SharePoint Online list
Here I have created a Project management List in SharePoint Online having 6 columns with the required column type.
|Column Name||Column Type|
|Title||Single line of Text|
|Start Date||Date and Time|
|End Date||Date and Time|
Once you create a SharePoint list for Project Management, next we will move to the next step to create a flow.
Step 2: Create a Flow in Power Automate
Now we will create a flow that will send an email with attachments from SharePoint using Power automate.
To create a flow, Login to Power Automate, then click on Create icon from the navigation bar, select Automate cloud flow.
Now provide a flow name, then select the trigger “When an item is created” to run the flow.
Step 3: When an item is created
In this step, we will provide the site address and list name to which you will assign the Project.
In the next step, we will initialize a variable with the type array, to create an array of all attachments.
Step 4: Create a variable that will store an array of all attachments
Now to create a variable, click on the next step, then select initialize variable.
Now, provide the name of the variable”ArrayAttachments”, and type Array. This array variable will use to create an array of all attachments of the newly created item.
Next step we will get the list of attachments from the newly created item.
Step 5: Get List attachments
To get all attachments, click on the next step, then select Get attachments.
Now provide the SharePoint site address, list name, and id from the dynamic content to get all the attachments of the newly created item.
Step 6: Read all attachments content
To read all the attachment contents, click on the next step and then select the Get attachment content.
Now provide the site address, list name, and id from the dynamic content.
In the File identifier, add the id of getting attachments from the dynamic content, after setting the file identifier, Apply to each loop will be added automatically in order to get the attachment content of each file.
In the next step, we will append the attachment in the array of attachments.
Step 7: Create an array of attachments
To create an array, click on the next step then select Append to array variable action inside the apply to each loop.
Now select the variable AttachmentArray as the name, which we have created in Step 4.
Then set the value with the below JSON
- Name: Set the display name from the dynamic content.
- ContentBytes: Set the attachment content of the Get attachment contents from the dynamic content.
Once we get the attachment content and append it to the array, in the next step send the email with the array of attachments.
Also, read, Power Automate Replace
Step 8: Send attachment via email
To send an email, click on add an action and select Send an Email V2 outlook.
Then provide the Email of the recipient i.e. Assigned to Email.
Set the Subject and Body of the Email. Then click on the Show Advanced option.
Then in the attachment section, click on the icon to switch to the entire array of attachments.
And then set the value of attachment to the AttachmentArray variable. Also, you can set the importance from low to high.
Once your flow is ready, click on the save and test the flow manually by adding an item to the SharePoint Online list.
Step 9: Run the Flow
To run the flow we will add a project/item to the SharePoint list.
So here I have added a project “SharePoint Migration” with attachments and assigned it to user5, so user 5 will get an email.
Now, user5 will get an email with attachments like the below screenshot.
And also you can check the flow in Power automate, that your flow ran successfully or not.
In this Power Automate tutorial, we learned how to send an email with attachments from SharePoint using Power Automate or Microsoft flow.
Related Power Automate tutorials:
- Power Automate Switch Case Multiple Conditions
- Power Automate update SharePoint list item
- Move files from OneDrive for Business to SharePoint Online
- Convert SharePoint document to PDF using Power Automate
- Convert SharePoint list item to PDF using Flow or Power Automate
- Power Automate create an HTML table
- Power Automate Create a CSV Table
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Out audiences are from the United States, Canada, United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a SharePoint MVP(8 times), check out My MVP Profile. I have also worked in companies like HP, TCS, KPIT, etc.