How to dynamically add multiple attachments to a Power Automate approval flow?

Approval flows are great. The ability to approve/ rejects from emails or from Power Automate mobile app has indeed changed the way approvals are done.

And if you think about approvals, you cannot skip attachments in approvals. Inside an approval flow, you can add multiple attachments. But how to send multiple attachments dynamically in SharePoint approval flow?

Let’s take an example here. I send out an approval notification each time a SharePoint List item record is created. If the list item has attachments, the attachments should be included in the approval flow.

Let’s get started. The first few steps are quite simple.

dynamically add multiple attachments to a Power Automate approval flow?

I am using the Get Attachments action to get all the attachments for the list item. I also initialized an array variable to handle the collection of attachments.

In the next steps, I iterate through each of the attachments, get the attachment content and append the content to the array variable.

dynamically add multiple attachments to a Power Automate approval flow?

What is important here is the “Append to array variable” step. You should use create a JSON with two properties – Name and Content. You can set the value of these two properties from the Dynamic content.

Now when the flow is run, you should receive the email notification for approval with the attachments too.

Quick note – I have seen some examples where the content property is set using the following expression.

body('Get_attachment_content').$content

The approval flow shall work. And you would get an email too with the attachments. But remember, you are just sending the content bytes and not the content type.

So when the user download the attachment from the email and try to open the file, they will get an error. For example – Below is the error when I try to open a downloaded .pdf file.

dynamically add multiple attachments to a Power Automate approval flow?

Hope this helped!

You will also like the below posts.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading