
This flow is in response to a question posed by a Tiago Santos de Araujo:
Question: I need to upload attachments from different questions on Microsoft Forms and send all these files together in the same Approval .
Comment on the post How to send Microsoft Forms file uploads to an Approval workflow using Power Automate
This post was last updated:
In my previous post “How to send Microsoft Forms file uploads to an Approval workflow using Power Automate” I created a flow that accepted files uploaded from a Microsoft Form (an Application form). The uploaded files were then attached to an approval action. However the flow only worked with a single forms upload question (i.e. a single forms control).
We need a new flow that can work with multiple form upload questions (i.e. it needs to work with multiple forms control).
In this tutorial I show you how to create a simple Power Automate flow that will send multiple file uploads from multiple Microsoft Forms questions to an approval workflow.
The example scenario here is a Cafe Manager uploading a new menu each week via Microsoft Forms and then being sent for approval to his or her boss.
The image below shows what is needed in the new flow. The Weekly Menu Upload form requests the manager to upload four menus: Breakfast, Lunch, Teatime (if you are British!) and Dinner.

The steps in this flow will be:
- A manager completes a Microsoft Form and uploads multiple files
- Get the Manager’s Forms response
- For each file upload control (i.e. each file upload “question”):
- for each file that was uploaded – Get the filename and content (these files are stored in OneDrive)
- Note that the manager may upload zero, one, or multiple files for each question
- Create an Approval and add the file uploads as attachments to the approval action

This Weekly Menu Upload form has been configured so that file uploads are optional. A limit of one file upload per question has also been set. However, the flow will still be able to handle multiple file uploads per question.

Here is the entire flow

Get the Forms response

Initialize an array variable to store the responses to the file upload questions
We need to initialize an array variable. The array variable will store the responses to the file upload questions. We will later loop through each question saved in the array and get every file that was uploaded. The user may upload zero, one or multiple files per question.

Populate the array with the forms upload dynamic content as shown in the examples below:

Please pay close attention to the format of the array variable:

Initialize another array variable to store the attachment filenames and content
This array variable will be used to append (store) the attachment filenames and content):

The array will be attached to the Approval action later in the flow.
The Apply to each loop for questions
We need to loop through each question (which are now neatly stored in varFileUploadQuestions array) using an Apply to each loop:

As we loop through each question using an Apply to each loop we need to get every file that was uploaded and for that we will need to use a second Apply to each loop. Remember that for each question, a user could upload multiple files.
Check if a file was uploaded
Let’s add a condition action to the flow to check whether the user uploaded a file:

Our Apply to each loop now looks like this:
If a file was uploaded we can continue with the approval workflow in the Yes block. But if no file was uploaded, we take no further action and the No block is left empty. For a deeper dive into how this condition check works, see How to send Microsoft Forms file uploads to an Approval workflow using Power Automate.
The Apply to each loop 2 in the Yes block
We need to loop through the details about each file that was uploaded and for that we will use another Apply to each loop:

We need to get the following information about each file:
- filename
- file content
and then append the filename and file content to the attachments array.

We need the filename and content of the uploaded file. We then append this information to the attachments array.
This is the overall view of the Apply to each loop. I will break this down into their individual actions below.

The Apply to each loop requires information about the uploaded files to be in JSON format. We can construct an expression to get this information into JSON format by “wrapping” the dynamic content for the question’s file upload property inside a json function:

Get file metadata Action
Add a Get file metadata action:

and use the following expression as the file value:
items('Apply_to_each_2')?['id']
This action will later helps us easily get the name of the uploaded file and its content.
Get file content action
Next we get the file content using the Get file content action as shown below:

Fill the array with the filename and file content
Add (append) the filename (Display name) and file content to the attachments array:

Here is closer view of the append to array action. The content of the array requires a specific format if it is going to be used as an attachment in the approval action:

You can type the content in manually or you can copy-and-paste the following code:
{ "name": @{outputs('Get_file_metadata')?['body/DisplayName']}, "content": @{body('Get_file_content')} }
We have now completed the acitons for the Yes block :

The Approval action
This is the flow so far:

The final action is to add an approval action (e.g. Start and Wait for an approval) and insert the array variable in to the approval action:

And that’s it for this flow.
Runtime Outputs
Here is an example of a form with four menu files being uploaded:

Example Email Notification
Note below that the four menu file attachments have been sent along with the email notification:

Example Teams Approval Notification
Note that file attachments don’t appear in Teams approvals:

This may be a bug or a limitation of the current approvals notification sent by Power Automate. Have you found a way to make the attachments appear in the Teams app?
Attachments not appearing in the approval notification message?
I have found that forms file attachments only appear in the email approval notification sent by Power Automate. File attachments don’t appear in the Teams approval so make sure that you have enabled notifications for the approval action. By enabling this setting Power Automate will send an email notification messages to the approver:

Corrupt attachments? Attachments won’t open?

Different solutions on how to construct the attachments array have been discussed in Power Automate forums. The flow I have presented here seems to work with Forms file attachments for approval workflows.
However, if you find that in some instances the above does not work, i.e., the file attachment won’t open, I have included an alternative format for the attachments array.

You can copy and paste the following code in to the Append to Approval Attachments array variable action as shown above:
{ "name": @{outputs('Get_file_metadata')?['body/DisplayName']}, "content": { "$content-type": @{body('Get_file_content')?['$content-type']}, "$content": @{body('Get_file_content')?['$content']} } }
For further information about this, see:
- Short Notes: The format of File Attachment Arrays for Approvals and Outlook Emails
- After saving Outlook file attachments to SharePoint, the files won’t open: Uploading Excel email attachments to SharePoint library
- Tachytelic.net: Add multiple attachments to an approval email with Power Automate
- Power Automate Community Blog: Adding multiple attachments to the approval email with Power Automate
Leave a Reply