cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Power Automate approval with Attachments

I am trying to add an attachment to the Power Automate Approval using append array. However, it fails on the content bytes. 

 

Has anyone successfully attached an item from sharepoint to the power automate approval connector?

3 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hey @Jevon 

 

As mentioned in my earlier response, the approvals action does not recognise contentbytes and so you need to use the content key to pass the file content. 

 

Also, can you check and confirm the expression being used in your flow?

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hey @Jevon 

 

This is a known bug that has come to light recently. This is currently being worked on by the support team and we should soon have an update on that. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Advocate I
Advocate I

Re: Power Automate approval with Attachments

image.png

This is what I see in the peek code for the side of my if statement which is where an excel file would end up.

View solution in original post

36 REPLIES 36
Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hey @Jevon 

 

Can you share a screenshot of the error that you are seeing? 

 

How are you constructing the array? I did it like this and it works as expected: 

211.PNG212.PNG

Expression in the array: 

body('Get_attachment_content')['$content']

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Helper I
Helper I

Re: Power Automate approval with Attachments

I tried but it says "enter valid json."

 

 
Highlighted
Community Support
Community Support

Re: Power Automate approval with Attachments

 

Hi @Jevon ,

 

Could you please provide the screenshot of Flow configuration?

 

Notice that there is a comma after DisplayName.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Power Automate approval with Attachments

Attachment_MS_PA_1.JPG

Highlighted
Community Support
Community Support

Re: Power Automate approval with Attachments

 

Hi @Jevon ,

 

Please copy the value below directly into the Value field.

{
"Name":@{items('Apply_to_each')?['DisplayName']},
"ContentBytes":@{body('Get_attachment_content').$content}
}

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Power Automate approval with Attachments

Attachment_MS_PA_3.JPG

I was successful with JSON however, this puzzled me on what connection did it refer to in the error messageAttachment_MS_PA_2.JPG

Highlighted
Community Support
Community Support

Re: Power Automate approval with Attachments

 

Hi @Jevon ,

 

Please replace Name to name and replace ContentBytes to content.

 

Try again.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hey @Jevon 

 

As mentioned in my earlier response, the approvals action does not recognise contentbytes and so you need to use the content key to pass the file content. 

 

Also, can you check and confirm the expression being used in your flow?

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Helper I
Helper I

Re: Power Automate approval with Attachments

Its now working on the attachment, however, it doesn't push through after the approver approved the approval request. Its just hang there. It push through if I remove the attachments. 

Attachment_MS_PA_5.JPGAttachment_MS_PA_4.JPG

Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hey @Jevon 

 

This is a known bug that has come to light recently. This is currently being worked on by the support team and we should soon have an update on that. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Helper I
Helper I

Re: Power Automate approval with Attachments

Oh snap! I was really excited on this as this removes the extra step to go to a form just to see the attachments / supporting documents for approval 😞

 

Thanks for the info that this is a known bug, hope this is resolved fast. 

Highlighted
Advocate I
Advocate I

Re: Power Automate approval with Attachments

Jevon - any news on MSFT fixing this bug?  I was trying this with an attachment array which worked just fine for Send Email with Options but failed with Start and Wait for an approval.  I'll have to see if 'content' works for the other action when I know that 'ContentBytes' works.

Highlighted
Dual Super User III
Dual Super User III

Re: Power Automate approval with Attachments

Hey @PhilipCaldwell 

 

The bug has been fixed for the approvals action. On the approvals action you need to use the content key but if you are using send email with options, you need to use the ContentBytes key. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Helper I
Helper I

Re: Power Automate approval with Attachments

I am trying again but it says : The variable 'Attachment' of type 'Array' cannot be initialized or updated with value

 

Is the attachment variable shouldn't be an array?Flow_error.PNG

 

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

I too am trying to attempt this.  I have set up my flow to be identical to the example @yashag2255  provided.  My flow keeps ending in the following error:

 

The request failed. Error code: 'InvalidRequestContent'. Error Message: 'The request content was invalid and could not be deserialized: 'Error converting value "[{"Name":"Sailing lesson costs.xlsx","content": ....... to type 'Microsoft.Azure.ProcessSimple.Data.Entities.ApprovalsConnectorAttachment[]'. Path 'attachments', line 1, position 21187.'.'.

 

I have no issues with JSON and have tried the following expression for the array:

body('Get_attachment_content')['$content']

 

Any assistance would be appreciated!!!

Thanks!

 

 

 

 

Thanks!!

Highlighted
Advocate I
Advocate I

Re: Power Automate approval with Attachments

Hi,  I'm running this and it is working:

 

image.png

When I loop thru the attachments to add them to my array, I also do something different with .txt files (probably have to do it with .csv etc.).  When it is a .txt file, I put the Attachment Content value I get back from Get attachment content in a base64() function so that it is encoded.

 
Highlighted
Advocate I
Advocate I

Re: Power Automate approval with Attachments

image.png

 

It didn't want to load my second picture so here it is.

Highlighted
Advocate I
Advocate I

Re: Power Automate approval with Attachments

@Jevon - yes, the variable should be an array.  In my flows, it is an array and it works.

Highlighted
Frequent Visitor

Re: Power Automate approval with Attachments

@PhilipCaldwell  I'm new to this forum and can't seem to get images to work so this is what I have done.  When I build the Array I have tried the following formulas:

 

body('Get_attachment_content')['$content']

base64(body('Get_attachment_content').$content)

 

Both end in the same error.  The file I am trying to use is in .xslx format.  Do I need to approach it differently with an Excel file?

 

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (8,296)