cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alexco
Level: Powered On

Get File Content as Base64

I am trying to retrieve a SharePoint file’s content as base64.

I'm using the "Get file content" Action which returns the file as binary. 

 

I've tried using the Compose Action with the following expression: @base64(string(body('Get_file_content')))

This differs from the Base64 representation that I get when doing this directly on the file (so not through Flow). 

 

What am I doing wrong? Is there an easier way of doing this?

 

If I just use the binary representation I just get something like this:

"[....]��(��U�N�0�#����q !Ԕ�# Q$���i-��w ��٤$ (-�DJ���ƣ�gg�GHh�/[....]" so I definitely need to transform it somehow before using it further.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
alexco
Level: Powered On

Re: Get File Content as Base64

Update: I found the solution. I should have used @base64(body('Get_file_content')) expression (without the string conversion). The Compose Action step is also unnecessary.

2 REPLIES 2
Highlighted
alexco
Level: Powered On

Re: Get File Content as Base64

Update: I found the solution. I should have used @base64(body('Get_file_content')) expression (without the string conversion). The Compose Action step is also unnecessary.

ReflexConsultin
Level: Powered On

Re: Get File Content as Base64

I was researching this as well. Although the answer suggested didn't work for me - i wanted to share that I was able to create an HTML file using basic code and inserted the base64 code in it. Then i found the new OneDrive Conversion function and managed to convert it and save it as an image with which i could update a Hyperlink column with a link to this newly created image. There might be quicker ways - but as a non programmer, it's the result that matter Smiley Happy 

Hope this helps.

FlowSetupFileConversion.jpg

>