web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Manipulating An Attach...
Power Automate
Answered

Manipulating An Attachments Array

(0) ShareShare
ReportReport
Posted on by 36

I'm trying to create a flow that does the following --

 

Receive an email with attachments --> Post an Adaptive Card to a Teams user and wait for a response -> Use that response to create an approval for the individuals designated in previous step and any attachments that were included on the initial email should be added to the Approval flow.

 

After receiving the data from the adaptive card in Teams, I initialize an Array variable called attachmentArray.

 

I then have an Apply to each loop on the Attachments output from the initial When a new email arrive (V3) step.  In this loop, I have an Append to array variable step with the following Name/Value --

 

Name: attachmentArray

Value: {
"name": @{items('Apply_to_each_attachment')['name']},
"contentBytes": @{items('Apply_to_each_attachment')?['contentBytes']}
}

 

The next step, the approval, fails with 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 643.'.'.

 

I don't seem to be able to paste images to this forum unfortunately, so hopefully someone can make sense of what is happening.

 

Thanks in advance.

 

Phil

Categories:
I have the same question (0)
  • Jay-Encodian Profile Picture
    2,920 on at

    Hey @pkluss 

    Try wrapping the dynamic data passed to the ContentBytes property in the base64ToBinary() expression.

    i.e. : base64ToBinary(items('Apply_to_each_attachment')?['contentBytes'])

    HTH

    Jay

  • Verified answer
    pkluss Profile Picture
    36 on at

    Thanks for the suggestion.  I had been following this post (https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/#comment-4337517593) and did not realize until reading the Comments, specifically this one, that there was an error in the construction of the attachments array.  I changed the append array step to the following and it works great now --

    Name: attachmentArray

    Value: {
    "name": @{items('Apply_to_each_attachment')['name']},
    "content": @{items('Apply_to_each_attachment')?['contentBytes']}
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 785

#2
Valantis Profile Picture

Valantis 669

#3
Haque Profile Picture

Haque 563

Last 30 days Overall leaderboard