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

Notifications

Announcements

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,129 Super User 2025 Season 2 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,129 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard