Skip to main content

Notifications

Power Apps Pro Dev & ISV
Unanswered

download a file using its base64 string

Posted on by
Hello everyone, I am having trouble with a canvas app I need to implement. 
I want to implement the following functionality:

1. Canvas app that is embedded inside Dynamics 365 model driven app, which retrieves some files from azure blob storage and downloads them.
2. I can only use Microsoft Entra ID authentication in my app for authenticating Azure Blob Storage, and I say this because the connector for Azure Blob Storage has some limitations, and one in particular is that I cannot use AzureBlobStorage.CreateShareLinkByPath(), which is exactly what I needed but is not possible.

What I am currently trying is to also connect a flow that runs when I click a button on the app, in the flow I am making HTTP call using azure blob storage API, and I actually get the file content I need in the flow, as shown in the screen shot below:



The file is in the filecontent variable which I am returning to the canvas app.

For context this is the actual variable. 
 
{
  "filecontent""UEsDBBQABgAIAAAAIQDfpNJsWgEAACAFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAA......
}
The string is actually huge I am only inputting the start of it.

After I return this is my app, I was trying to download it:

1. I tried Set(downloadLink, "data:application/octet-stream;base64," & filecontent), and then Launch(downloadLink)
2. I also tried Launching the filecontent as it is.

I also tried the Download function as well, but I got an error saying Invalid URL.

What I have noticed is that the filecontent variable that is returned from my flow, is nothing like the string I get when checking the flowruns (as shown in the screenshot above)
What I get in the canvas app is this: 
appres://blobmanager/4365b7f839f94989a9e6e10d68fe0572/1
I am not sure if I can use this to download the file. 

Any help is appreciated. 
 
  • Srini007 Profile Picture
    Srini007 2,640 on at
    download a file using its base64 string
    Hi,
     
    First, validate that the Base64 string you're getting is correct. You can search for "Base64 to file" on Bing, then paste the entire Base64 string to check if it converts properly.
    If the file is very large, it's better to use Power Automate "Create file" action, and then use SharePoint actions to download the file.
     
    Check below link for your reference
     
     
     
    If I have answered your question, please mark it as the Answered. If you like my response, please give it a Like.
    Regards,
    Srini
     

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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Tuesday Tip #2 Global Search…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,008

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,531

Leaderboard