cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FedericoCoppola
Helper III
Helper III

The request content was invalid and could not be deserialized using Array

Hi,

I stated to use Array in this flow due to I need to attach different document (if they exists) to Approval Mail.

 

When I save all seem to be good, but now that I am running and testing the flow I get the following error:

 

The request failed. Error code: 'InvalidRequestContent'. Error Message: 'The request content was invalid and could not be deserialized: 'Could not find member 'ContentBytes' on object of type 'ApprovalsConnectorAttachment'. Path 'attachments[0].ContentBytes', line 1, position 689.'.'.

 

 

FedericoCoppola_1-1604496501484.png

 

I have configured "Append to array variable" like this:

{
"Name": [DisplayName],
"ContentBytes": [Attachment Content]
}

FedericoCoppola_2-1604496715748.png

 

How can I solve it?
It is really important for me.

 

Thanks
Federico

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ManishJain,

thanks for you reply!
I have solved using base64() function.

 

Best regards
Federico

View solution in original post

9 REPLIES 9
ManishJain
Solution Sage
Solution Sage

Hi @FedericoCoppola ,

 

In Apply to each use concurrent settings and use Compose action with JSON format you have used . Outside of apply to each use another compose and in expression use outputs(Compose) , not many of us know about this feature to get array . 

 

Thanks

Hi @ManishJain,

thanks for you reply!
I have solved using base64() function.

 

Best regards
Federico

Hi @ManishJain ,

can you explain it better?
I did not understood very well, sorry!

 

Federico

ManishJain
Solution Sage
Solution Sage

Hi @FedericoCoppola ,

 

In Order to form an array without using set variable action you can use compose action and do the same thing in compose action which you were doing in set variable inside loop. Outside loop you can do another compose action and use in expressions outputs(Compose) . This compose variable is from the loop. It will give you output as array.

 

Thanks

jaina
Resolver II
Resolver II

hi @FedericoCoppola  can you share the final workflow how it looks like? thanks

yaheardj
New Member

How did you solve this? base64? Can you show a screenshot? 

 

{
"content": {
"$content-type": "@{body('Get_attachment_content')['$content-type']}",
"$content": "@{body('Get_attachment_content')['$content']}"
},
"Name": "@{items('Build_Attachment_array')?['DisplayName']}"
}

IG_Samuel_0-1645540909681.png

 

I found this helpful:
Solved: Re: Flow attachment Error - Power Platform Community (microsoft.com)

 

It doesn't use Compose - you can convert the attachment content into Base64 within the Append to array function.

 

{
"name":DisplayName,
"content": base64(body('Get_attachment_content'))
}

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,336)