While working on a leave request application, I needed to send an approval request with an attachment to the approver. The approver should be able to open the file and review it before choosing to approve or reject it.
In this tutorial, I will explain how to send an approval request with an attachment using Power Automate.
Send an Approval Request With an Attachment Using Power Automate
I created a SharePoint list using the below column and data types for this example.
| Columns | Data Types |
|---|---|
| Employee ID | Single line of text (Title) |
| Employee Name | Person or Group |
| Leave Type | Choice |
| Start Date | Date and time |
| End Date | Date and time |
| Reason for Leave | Multiple lines of text |
| Manager | Person or Group |

Here, I want the flow to start when an item is created in the Employee Leave Requests list.
Let’s see how to create it:
1. Create an automated cloud flow. Give the flow name and select the trigger When an item is created. Also, provide the Site Address and List Name.

2. I will take the Initialize variable action to store the attachments. To do this, provide the below Parameters as it is:
- Name: varAttchments
- Type: Select Array from the drop-down
Here, I changed the action name Initialize variable to Initialize variable | var Attachments.

3. Next, add the ‘Get attachments‘ action and provide the below parameters:
- Site Address: Select a specific SharePoint site from drop-down.
- List Name: Choose a particular list.
- Id: Select Id from dynamic content under When an item is created.

4. After that, take the Get attachment content action to retrieve the details from the attachment. Then, Provide the below parameters:
- Site Address: Select a specific SharePoint site from drop-down.
- List Name: Choose a particular list.
- Id: Select Id from dynamic content under When an item is created.
- File Identifier: Take Id from the dynamic content of Get attachments.
You can see that a For each loop will be added automatically, taking Body outputs from Get attachments.

5. Then, add Append to array variable action inside the loop, and set the below details:
- Name: Select the name from the drop-down.
- Value: Insert the below given code.
{
"name": "@{item()?['DisplayName']}",
"content": {
"$content-type": "@{body('Get_attachment_content')?['$content-type']}",
"$content": "@{body('Get_attachment_content')?['$content']}"
}
}
6. Next, add the “Start and wait for an approval” action specifying to start of a manager approval process. This action has below fields:
- Approval type: Select an approval type as “Approve/Reject – First to respond” from the drop-down.
- Title: Enter the title field value from the Dynamic content.
- Assigned to: Assign the email of the person who will approve/reject the request; in my case manager, I give the manager an email from dynamic content.
- Details: Enter the details about the requested from the Dynamic content.
Then, click Show all to display the advanced parameters.
- Attachments: Add attachments variable from dynamic content.

7. Now, we will add the Condition action to check whether the leave request is approved or Rejected.
In this Condition action, select the Outcome (from Start and wait for an approval action) value equal to Approve.

8. Next, add the Send an email (V2) action under True condition.
- To: Take Employee Email from dynamic content.
- Subject: Provide a subject line for a mail.
- Body: Enter a detailed description of the mail along with taking dynamic content.

9. Under the False condition, take the Send an email(v2) condition and set the parameters as To, Subject, and Body as shown in the screenshot below:

Once the Flow is ready, we will move forward to run the Flow.
Run the Flow to Send an Email With an Attachment From the SharePoint List
Now, it’s time to save the flow. Click on Test -> Select Manually. Add an item to the SharePoint list with an attachment at this step.

When the flow runs, it will send the manager an approval request with an attachment, as shown in the screenshot below.

This way, you can send approval requests with attachments from the SharePoint list using Power Automate.
Action ‘Append_to_array_variable’ failed: Unable to process template language expressions in action Power Automate
After creating the above flow, I checked with various scenarios, and I found that the flow successfully ran when the attachment files like PDF, Excel, Word document, jpg, or PNG, but when I tried with a text file (.txt), it gives me an error like below:
Action 'Append_to_array_variable' failed: Unable to process template language expressions in action 'Append_to_array_variable' inputs at line '0' and column '0': 'The template language expression 'body('Get_attachment_content)?['$content-type']' cannot be evaluated because property '$content-type' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'
[Solved] Action ‘Append_to_array_variable’ failed: Unable to process template language expressions in action Power Automate
To solve this error, follow the steps below:
Open the Append to array variable action inside the loop, and set the below details:
- Name: Select the name from the drop-down.
- Value: Insert the below given code.
{
"Name": "@{items('For_each')?['DisplayName']}",
"Content": "@{body('Get_attachment_content')}"
}
Then save the flow; now add the item to the sharepoint list with a text file attachment. Then, you can see the approver get the text file in Outlook.
![Solved Action Append to array variable failed Unable to process template language expressions in action Power Automate [Solved] Action 'Append_to_array_variable' failed Unable to process template language expressions in action Power Automate](https://www.enjoysharepoint.com/wp-content/uploads/2024/08/Solved-Action-Append_to_array_variable-failed-Unable-to-process-template-language-expressions-in-action-Power-Automate.jpg)
I trust this Power Automate tutorial gave you an idea of how to send a Power Automate approval request with an attachment. Also, I discussed how to solve the action ‘Append_to_array_variable’ failed: Unable to process template language expressions in Power Automate.
Also, you may like:
- Send Approval Requests to Multiple Approvers Using Power Automate
- Create a Word Document From a Template in Power Automate
- Send Approval Requests to Outlook and Teams Using Power Automate
- Create Custom Response Options for Approval Flows in Power Automate
- Send an Email With Attachment From SharePoint List using Power Automate

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.