This post was last updated:
This beginner’s tutorial will guide you through the process of creating an approval workflow for file attachments submitted via a Microsoft Form.
The flow will attach the uploaded file attachments to the approval action, making it easy for approvers to review and act upon them. This workflow is designed to work seamlessly even when multiple files are uploaded. By the end of this tutorial, you will have a solid understanding of how to create an approval workflow that utilises file attachments from a Microsoft Form.
The steps in the flow
- A user completes a Microsoft Form and uploads files
- Get the user’s Forms response
- For each file that was uploaded, get its filename and content (uploaded files are stored in OneDrive)
- Create an Approval and add attachments to the approval action
This is the Form we will use for the demo

What to do if your form has more than one File Upload question
The flow assumes that the Application form has only one file upload control. However, your form could have multiple file upload controls as we see in the example form called Weekly Menu Upload.

If your form has multiple file upload controls then see How to send Microsoft Forms file uploads with multiple questions to an Approval workflow using Power Automate.
The flow also assumes that file uploads are a required field meaning that users are required to attach a file before submitting the Application form:

If file uploads are optional in your form, then continue to follow the tutorial below, then make the changes as shown in the section Form is submitted without an uploaded file and the flow fails .
Here is the entire flow

Get the Forms response and initialize an array variable
We get the form response and initialize an array variable. The array variable will be used to store the attachment filenames and content:

The Apply to each loop
We need to loop through the details about each file that was uploaded and for that we will use the Apply to each loop.
We then 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 get this information into JSON format by “wrapping” the dynamic content for the Upload your file 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')?['id']
This action will later help 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')}
}
The Approval action
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 the flow.
Runtime Outputs
Here is an example forms file with three files that have been uploaded:

Example email notification
Note that the 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?
PROBLEM #1: 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:

PROBLEM #2: 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
PROBLEM #3: Form is submitted without an uploaded file and the flow fails
If a file upload is an optional requirement in your form, a user could submit a form without a file and this will cause the flow to fail as there will be no file for the flow to process:


To fix the error you could (1) make the file upload a required field, or (2) change the flow to handle the situation if no file was uploaded.
Option 1: Make the file upload a required field
To fix this make the file upload a required field. The flow does not need to be changed.

Option 2: Change the flow to handle no file uploads
We can determine whether a file was uploaded or not by checking the forms response. We need to look at the content of the file upload field (property) shown below as Upload your file :

The Upload your file propetry field (it’s actual internal name inside my flow is r39184e70bc0845338547b8ac381488fd) will be empty if no files were uploaded. If a file was submitted with the form it will not be empty:

So let’s add a condition action to the flow to check whether the Upload your file property is NOT empty (i.e. it contains a file).

If the file upload field is not empty a file was uploaded and we can continue with the approval workflow as before. But if no file was uploaded, the flow will end at this point and we will take no further action in this demo flow as the purpose of the flow is to approve the file uploads. You can add actions to the No block below for when no file was uploaded by the user, such as sending an email to the submitter asking them to submit the approval if required.

The updated flow should now looks like this:

Alternative ending…
However, if you may want to still continue with the approval workflow even when a file was not uploaded. We need to make another change. Move the Start and wait for an approval action to the end of the flow. You should be able to select the Start and wait for an approval action and drag it outside of the Yes block:


The updated flow now looks like this:

For further reading:
- Short Notes: The format of File Attachment Arrays for Approvals and Outlook Emails
- 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
Thanks for sharing this. I tried to implement it, but I’m running into an issue where if a Form is submitted without an uploaded file, the flow fails. Do you know a way to make this work regardless of whether a document is uploaded or not?
Thanks!
Hi Patrick,
Thanks for your comment. I have added a section to the end of the post that shows how to handle the situation where a file upload is an optional requirement for a form and the user submitted a form without uploading any files. Hope this helps.
Ellis
Hi Mr. E. Karim,
Please, can you help me? I need to upload attachment from different questions on forms and send all together in the same approval .
Thanks a lot and have a nice weekend
Tiago A.
Hi Tiago,
Thanks for posting an interesting question. Please see the new post “How to send Microsoft Forms file uploads from multiple questions to an Approval workflow using Power Automate“. Hope this helps.
You can also post any questions you have about Power Automate on the Community forum at https://powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows
Best wishes,
Ellis
Thanks for the quick update Ellis. That worked!
Hi Karim,
Thanks for writing this blog. I followed your flow exactly as you stated. I successfully received the email with the attachments in my approval email. However, I’m unable to open the documents. Need your help to rectify this issue. Thanks
Hi Victor,
Thanks for posting this question.
I’ve updated the section “Corrupt attachments? Attachments won’t open?” in the blog post. This update offers a different format for the “append to array” action:
{
“name”: @{outputs(‘Get_file_metadata’)?[‘body/DisplayName’]},
“content”: {
“$content-type”: @{body(‘Get_file_content’)?[‘$content-type’]},
“$content”: @{body(‘Get_file_content’)?[‘$content’]}
}
}
I’ve created and tested a demo flow, and this should fix the issue.
Recently on the Power Automate Community forums a number of users have report the same issue, the most extreme example being:
https://powerusers.microsoft.com/t5/Building-Flows/Uploading-Excel-email-attachments-to-SharePoint-library/m-p/1768698#M195571
The question that still needs to be answered is: Why do different array format work for some people but generate corrupt attachments for others?
Hope this helps.
Ellis
Hi Karim,
Thanks for the quick response. I’ll try this out and appreciate all your sharings!!
Blessings
Hi Karim,
Fantastic blog about the Power automate
I have a question as I am trying to create a flow for the form created for personal reimbursement. The flow must trigger a condition where a user can submit a form on the basis of the department he/she is into likes of Finance, Sales & Marketing, IT, Construction etc. the email should have the attachment and i have used the following flow in:
when a new response is submitted > Get response details > initialize variable>Parse Json > Apply to each > start and wait for an approval
my question is where to add a condition for flow to determine if the right department manager is selected and manager’s name then an email can send through. its an individual approval not multiple ones.
I have looked at adding a condition before apply to each parameter, Parse Jason and even initialize variable but somehow email is not flowing after form is submitted with attached document.
Any idea about this?
thanks in advance if you can shed some light on this for me to finalize my pending flow
Hi Yanzzah,
I’m not entirely clear on the question. But if your form has the following choices for the departments:
* Finance
* Sales & marketing
* IT
* Construction
…you could initialize a variable to store each departmental managers email address. We can then easily reference the departmental managers email address using a simple expression:
Variable name: varDepartments
Variable Type: Object
Variable Value:
{
“Finance”: “finmgr@company.com”,
“Sales & marketing”: “s&m@company.com”,
“IT”: “itmgr@company.com”,
“Construction”: “consmgr@company.com”
}
To get the departmental managers email address we can use an expression with the following format:
variables(‘varDepartments’)?[]]
Example:
variables(‘varDepartments’)?[outputs(‘Get_response_details’)?[‘body/ra7a7d7d18c0644cc9076034e05daa585’]]
The expression could be used in the Get User Profile (v2) action to return the manager’s name, job title, and location etc.
This action(s) could be run immediately after the Get response details action.
Best wishes,
Ellis
Excellent read. Got here via google search.
I would like to create similar flow with two distinct changes. Form should be owned by SharePoint group (so the files aren’t saved to private onedrive, but sharpoint) and approvals sending not attachments, but sharable links to attachments.
You ask my why? Excellent question. In my organization sharing files to external entities is forbiden, only selected few users can do that. What I would like to create is Form where any user can request file share to “outside”. I see this being done with powerautomate + forms + approve. And if approved using send email v3 action.
How about if you are using a group Form? The uploads are stored in a SharePoint library.
This is a bit more fiddley.
(1) Instead of using the Form Name as the Id in your flow actions (i.e. When a new response is submitted, Get response details), you will need to use the form id number. You can find the form id number by opening the form and then examine the URL. You need the long code after the text “id=”, for example “MeJEhiJUvUe5IE1QqXU1HjY78unqHGlAgDgzTks2TERTM1NHTUFCMlFTTiQlQCN0PWcu”.
(2) Enter this form id value as a “custom value” in the “When a new response is submitted” and “Get response details” actions. (3) In the apply to each loop just use the “Get file content using path” action using the following expression items(‘Apply_to_each’)?[‘link’] for the file path.
If you still get stuck, post the question on the forum and tag me in the post as @ekarim2020 . Link to the forums https://powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows