Loading...

Handle Base64 and Binary File Content Types in Power Automate

Handle Base64 and Binary File Content Types in Power Automate
Did you know that there are two types of file or image content type used in the input and output parameters? In this post, you will learn how to handle the different types of file content in the cloud flow action parameters.


When working with the input and output parameters for file content, you need to provide a value as Binary data type for most of the input parameters (e.g. Upload file or image content) and its counterpart action (e.g. Get file or image content) returns the value in Binary data type. However, some of the actions require the Base64 data type and some outputs return Base64 data type. So how do you identify what you need and when to convert which?

Understanding what type of file content to use in certain parameter is important. Sometimes, conversion of one type to another is required when the type of the output is different from the required input for the next step (e.g. get the Note attachment file and upload to SharePoint).

Identification

To identify the file content type of the input/output parameters, the Connectors Documentation is the best place to start.

However, Microsoft Docs will not cover everything and you will need to figure out some dynamic parameters like documentbody value of the Note table or image column value by running the flow first to see the output value that is available for you to use.

🔗 Binary

All of the actions in the SharePoint connectors are consistent. Create file action requires the file content in Binary data type to upload the file and Get file content or Get file content using path returns the Binary data type. In Common Data Service (current environment) connector, Upload file or image content and Get file or image content uses the Binary data type but the rest of the parameters seems to be Base64.

🔗 Base64

To create a Note attachment, Base64 data type value needs to be populated in the Document column and Base64 value is returned when the documentbody column is retrieved from the Note table.

The same applies to retrieving the image column which returns the Base64 value.

To use images in the Populate a Microsoft Word template action, the file content value needs to be constructed with the Compose action with Base64 value in the following format, unless the value is already a binary value of JPG or PNG.
{ "$content-type": "image/png", "$content": "iVBORw0KG...i/DhQmCC" }
You can read more details on this topic from Olena Grischenko's blog post about Populating Word template with the image field content from Microsoft Dataverse.

Conversion

To convert from Base64 to Binary data type, there is a base64ToBinary function. However, there is no such function for converting the other way round. The trick to converting the other way around is to set the Binary value into the Compose action and use the ['$content'] property of the output. You can also directly use the ['$content'] property of the Binary output too (e.g. outputs('Get_file_or_image_content')?['body/$content'] will return Base64 value). You can find more details about Binary to Base64 conversion in the blog post .

Now let's see the conversions in action.

🔗 Create Note Attachment from SharePoint File

Get file content action will return the SharePoint file content in Binary but creating a Note attachment requires Base64 value. Using the ['$content'] property of the output with the following expression will populate with Base64 value to the Document column.
outputs('Get_file_content')?['body']?['$content']

Upload File with Binary Data

To upload the Binary data (e.g. documentbody column value of the Note attachment) to SharePoint or File data type column, base64ToBinary function can be used.
base64ToBinary(outputs('Get_a_Note_Attachment')?['body/documentbody'])

Populate Word Template Image

To construct the file content for the image placeholder in the Word template with the Binary data type, ['$content'] property can be used as in the following expression.
outputs('Get_file_or_image_content')?['body/$content']

🛈 Note

Compose action step is required to construct the input for the image content using the Base64 value and populate the output of the Compose step to the image placeholder. If the content JSON is directly populated, the step will fail with the following error.
The image is not of type PNG or JPG. Please provide an image of type PNG or JPG.

Summary

There are two types of file content (Binary and Base64) used in the input and output parameters and it is important to use the correct type based on the required parameter. To convert from Base64 to Binary, base64ToBinary function can be used and ['$content'] property of the Binary output can be used when needing a Base64 value.

Published on:

Learn more
Linn's Power Platform Notebook
Linn's Power Platform Notebook

A blog about Dynamics 365 and Power Platform (canvas apps in Power Apps and flows in Power Automate).

Share post:

Related posts

How to Identify and Update Power Automate HTTP Request Trigger Flows Before November 2025

Few weeks back, while working on one of our Power Automate flows, we noticed a banner warning on the HTTP Request trigger step. Microsoft has ...

4 days ago

Power Automate – HTTP and Teams webhook trigger flows are moving to new URLs

As of August 2025, Power Automate flows and Agent flows (Copilot Studio) with HTTP triggers or Teams Webhook triggers that have logic.azure.co...

5 days ago

How to Automate Document Signing with DocuSign in Power Automate

Introduction In an earlier Inogic post, “Streamlining E-Signatures in Multi-Step Forms with Power Pages and DocuSign Integration”, Our previou...

8 days ago

Power Automate Retry and Error Handling Patterns for Reliable Power Pages Integrations

When Power Pages integrates with Power Automate, reliability becomes key. Portal users expect instant responses — whether submitting a form, u...

10 days ago

Handling Large Files in Power Automate

Power Automate can handle large files, but how large? SharePoint Online supports files up to 250 GB, which sounds generous until you try movin...

10 days ago

UTCNow and that little hidden feature in Power Automate

If you have been following my posts on SharePains.com, then you will know about the UTCNow function generating the current UTC time. But did y...

11 days ago

Understanding Binary and Base64 in Power Automate

If you work with Power Automate and deal with files, you’ve encountered issues saving them. If you see things like “String/bytes i...

17 days ago

How to Auto-Fill Third-Party Web Forms Using Power Automate Desktop and JavaScript

In today’s digital workflows, teams across HR, operations, finance, and support deal with repetitive manual tasks every day. One of the most c...

18 days ago

How to Design Custom Approval Buttons in Outlook Email Using Power Automate (Step-by-Step Guide)

Microsoft’s standard approval emails make it easy to send and capture user feedback directly through Outlook. However, one major limitation is...

20 days ago

We need to talk about... Power Automate... Licensing

Next in my blog, I am going to cover a topic that has come up several times in recent conversations with clients.....Microsoft Licensing! part...

23 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy