I have written an article here on how to share multiple attachments via Email using Power Automate.
Let us have a look at a detailed steps to implement this .
Step 1 – Create the blank Microsoft Flow
- Go to flow.microsoft.com, sign in with your work or school account, click on My flows menu in the left navigation bar, and then click on ‘+New’ and Select Instant – from blank.
- Click on the Skip option given below and then give the flow name at top left in next screen.
Step 2 – Select a Trigger point of the Flow
- Search for the appropriate trigger when you want the flow to initiate.
- Here, we will select the trigger as ‘When an item is created’ which means that the flow will run whenever a new item is created in selected SharePoint list.
- Select the Site Address and List name where an item will be added along with the attachments.
Step 3 – Initialize Variable and Get List Attachments
- Click on +New Step and Choose an action ‘Initialize Variable’.
- Give the variable name say ‘AttachmentArray’ of type Array which we will use to create an array of all the attachments of newly created item.
- Now, add another action ‘Get attachments’ and select the Site Address and List name .
- Set the Id to ID of When an item is created trigger from the Dynamic content which appears in right as shown below.
Step 4 – Read Attachments Content and Create an Array
- Add an action ‘Get attachment content’ and select the Site Address and List name .
- Set the Id to ID of When an item is created trigger from the Dynamic content which appears in right.
- Set File Identifier to Id of Get attachments from the Dynamic content as shown below.
- As soon as you set the File Identifier , an Apply to each loop will be added automatically in order to get the attachment content of each file.
- Add ‘Append to array variable’ action after Get attachment action and within the Apply to each loop.
- Select the variable ‘AttachmentArray’ as Name which we have created at the beginning of the flow.
- Set the Value to the following JSON where
Name – will be the DisplayName of Get attachments
ContentBytes – will be the Attachment content of Get attachment content.
{
"Name": @{items('Apply_to_each')?['DisplayName']},
"ContentBytes": @{body('Get_attachment_content')?['body']}
}
Step 5 – Send attachments via Email
- Finally, add an action ‘Send an email (V2)’.
- Set the values of To, CC and BCC to whom you have to send an email and add Subject, Body .
- Set the From(Send as) value to the Email address to send mail from if needed else the mail will be sent from the person whose connection is set in the flow.
- Set the value of Attachments to AttachmentArray variable.
- Set the Importance to Low, Normal or High if needed.
That’s all, the flow is ready in few simple steps.
Now, let us check how the flow will work .
Add a new item in the SharePoint list along with the multiple attachments .
I have created an item and added 2 attachments with it .
An Email is received having the attachments as shown below –