Short Notes: The format of File Attachment Arrays for Approvals and Outlook Emails

The following format of file attachments arrays for Approvals and Outlook Emails seem to work well in Power Automate:

The format of the attachments array for Approvals and Outlook Emails. Note the similarities and differences.

Corrupt attachments? Files won’t open?

If you find that in some instances the above does not work, i.e., the file attachment won’t open, I have included an alternative format for the attachments array.

File Attachments for Approvals #2

In APPROVALS 2 below I specify the content-type so that app knows what the media/file type of a resource is.

{
  "content": {
    "$content-type": @{items('Apply_to_each')?['contentType']},
    "$content": @{items('Apply_to_each')?['contentBytes']}
  },
  "name": @{items('Apply_to_each')?['name']}
}

For a working example see the section Corrupt attachments? Attachments won’t open? in How to send Microsoft Forms file uploads to an Approval workflow using Power Automate

File Attachments for Email #2

And in EMAIL 2 below I specify the content-type so that app knows what the media/file type of a resource is.

an alternative for Outlook Attachments
{
  "name": "@{items('Apply_to_each')?['DisplayName']}",
  "contentBytes": {
    "$content-type": "@{body('Apply_to_each')?['$content-type']}",
    "$content": "@{body('Apply_to_each')?['$content']}"
  }
}

The example below shows the attachment array added to an approval action and an Outlook email:

File attachment arrays added to an Approval action and an Outlook email.
File attachment arrays added to an Approval action and an Outlook email.

Why do different array format work for some people but generate corrupt attachments for others?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Website Built with WordPress.com.

Up ↑

%d bloggers like this: