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 Pages / Work with datatype File
Power Pages
Answered

Work with datatype File

(0) ShareShare
ReportReport
Posted on by 117

In a HTML template I have a FetchXML query, one of the columns has datatype File that stores an PDF, is it possible the download of the file with Javascript?

Categories:
I have the same question (0)
  • Verified answer
    EmadBeshai Profile Picture
    806 Moderator on at

    Hi @sweb ,

     

    File content is stored in the Azure blob. Dataverse retains information needed to retrieve the contents upon request for retrieval. Here are some documents that provide an overview of the file type:

    File columns (Microsoft Dataverse) - Power Apps | Microsoft Docs'

     

    To get the content of the file by using power automate please check this https://learn.microsoft.com/en-us/power-automate/dataverse/upload-download-file

     

    Now you need to know how to create the flow and calling it by using JS from power pages, please check this https://readyxrm.blog/2023/06/01/trigger-power-automate-flows-from-power-pages/

     

    If this post helps you with your problem, please mark your as Accepted Solution.
    If you like my response, please give it a Thumbs Up.

  • sweb Profile Picture
    117 on at

    Thanks @EmadBeshai, I definitely have more insight now.

    Have managed to download the PDF, but it's broken.

    The difference from the original file seems to be the encoding, the original file has Windows 1252 encoding while the one I save with Blob is UTF-8, also the size is double, any idea what the problem may be?

     

    Have tested in Power automate, the output of "Download a file or an image" is

    {
     "$content-type": "application/octet-stream",
     "$content": "base64 data"
    }

    If I manually decode the data of $content I get the proper PDF.

    Next step is "Return value to Power Pages", no matter if I choose "Text" or "File" and the value as "File or image content", I get the wrong encoded.

     

    Is it possible to get a string that is base64 encoded? This way maybe I could decode it myself with JS and create the file after.

     

     

     

     

     

     

     

  • EmadBeshai Profile Picture
    806 Moderator on at

    Hi @sweb ,

     

    You can return the file content by writing the below expression and returning it as shown below 

    dataUri(outputs('Get_file_content_using_path')?['body'])

     

    EmadBeshai_0-1698439369920.png

     

    If this post helps you with your problem, please mark your as Accepted Solution.
    If you like my response, please give it a Thumbs Up.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 50

#2
Valantis Profile Picture

Valantis 26

#3
omkarsupreme Profile Picture

omkarsupreme 24

Last 30 days Overall leaderboard