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 / Convert Binary Variabl...
Power Automate
Answered

Convert Binary Variable to Base64

(1) ShareShare
ReportReport
Posted on by 36
Hi,

I'm creating a desktop flow in which I need to to convert a Binary Variable to base64.

I'm extracting this binary data from a Dataverse Table.




Using the action "Download a file or an image from selected environment", it creates an Binary Variable with the following content:


However, when I try to use a PowerShell script to convert the Binary data:
 
# Convert a binary variable to base64
$binaryVariable = %GetEntityFileImageFieldContentWithOrganizationResponse%

# Convert the binary data to a Base64 string
$base64String = [Convert]::ToBase64String($binaryVariable)

# Output the Base64 string
Write-Output $base64String
I get the following error:

Byte : The term 'Byte' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 
the spelling of the name, or if a path was included, verify that the path is correct and try again.
+ $binaryVariable = Byte [65747]

Could you help me?
 
I have the same question (0)
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at
    Hi,
     
    Instead of powershell- could you try this way ?
     
    1. download file from dataverse table using download file or image file from dataverse table 
    2. Convert the binary data from dataverse action to file using convert binary to file action.
    3. Convert the file to base64 using convert file to base64 action 
     
    see the flow below
     
     
     
     
     
     
    See whether this helps ?
     
    Thanks & Regards,
    Nived N 
    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs
     Found my answer helpful? Please consider marking it as the solution!
     Your appreciation keeps me motivated. Thank you!

     
  • Suggested answer
    RVF99 Profile Picture
    36 on at
    @Nived_Nambiar

    Thanks for your suggestion!

    Yes, I've tried this workaround and it works.

    But the idea is to avoid creating a local file and having to delete it later. That's why the file is stored in Dataverse.

    Kind Regards,
    RVF
  • Verified answer
    RVF99 Profile Picture
    36 on at
    Hi,

    I found an solution using .NET instead of PowerShell.

    The Binary Variable is an Binary Object Type: Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.Types.BinaryObject
    Microsoft Documentation: Learn Page

    Here is the code below:
     
    import System.IO
    
    byte[] binaryData = BinaryVariable.Data;
    Output = Convert.ToBase64String(binaryData);
    Where BinaryVariable is an dynamic input type
    Output is string.

    Kr,


     
  • Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at
    Good to know issue is resolved !
     
     

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard