cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jevon
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
yashag2255
Dual Super User II
Dual Super User II

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

yashag2255
Dual Super User II
Dual Super User II

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

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

41 REPLIES 41
yashag2255
Dual Super User II
Dual Super User II

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!

I tried but it says "enter valid json."

 

 

 

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.

Attachment_MS_PA_1.JPG

 

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.

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

 

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.
yashag2255
Dual Super User II
Dual Super User II

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

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

yashag2255
Dual Super User II
Dual Super User II

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

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. 

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.

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!

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

 

bschult2
Frequent Visitor

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!!

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.

 

image.png

 

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

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

@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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,145)