Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Assign approval task with multiple (0 – n) attachments in Power Automate

Posted on November 8, 2020April 14, 2021 by Tom

“I need for the approver to be able to approve up to four files at the same time in his Power Automate approval task, is there a way to make the number of attachments optional?”


To make the approval process in Power Automate as user friendly as possible, you might want to include attachments in the task. It can be the item attachments or multiple documents from a library, but you can’t predict how many files it’ll be. And that can be a problem in the ‘Start and wait for an approval’ action. If you define more attachments than you have, the flow will end with ‘InvalidAttachmentName’ error. If you define less attachments than you have, some documents will be missing in the task.

Approval task input attachment detail

The solution is to build a dynamic array with the attachments as a variable and use it in the action.

Approval task input attachments array

Adding the attachments

First step you need to do is to initialize the array variable.

Initialize array variable

The next step is to get all the files. It can be ‘Get attachments’ action, ‘Get files’ action, or a list of files you’ll build by yourself. To keep the number of files optional you must be able to loop (‘Apply to each’) through them.

Loop through all the attachments, get their content, and append them into the variable with the ‘Append to array variable’ action. The code below shows you the format, just don’t forget to replace the <placeholders> with your dynamic content.

{
  "Name": <DisplayName>,
  "content": <AttachmentContent or FileContent>
}

Warning: make sure you don’t add any character nor white space after the <AttachmentContent or FileContent> dynamic content. Otherwise you’ll end with ‘AttachmentContentNotValidBase64String’ error.

In the example below, you’ll take all attachments from a SharePoint item and append them into the variable.

Store item attachments into array

Last step is to send the actual approval task, with our array variable as attachments.

Assign task with array of attachments

As a result, the approver will receive an approval task with all the attachments. Not only in the email, but in the task in the Power Automate application as well.

Approval task with multiple attachments

Summary

While I generally don’t recommend sending files as email attachments, I’d make an exception in the approval task. For the approval process it’s much easier if the approvers have all the information at the same place. The information needed for approval in the task, the final approval history directly in the list/library.

Unless they need to do some update in the file itself, then a link to the file locations is the only way.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

1 thought on “Assign approval task with multiple (0 – n) attachments in Power Automate”

  1. A P says:
    November 29, 2023 at 3:56 pm

    Hi,

    This has been working flawlessly for my approval flow, although recently, it has begun to not include all attachments. The 3 PDF attachments total 800kb, so I do not suspect a file size limit issue. Is this a known bug?

    Thank you!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes