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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Odata Download Blob

(0) ShareShare
ReportReport
Posted on by 49
Hi, 
i have a custom table that has various fields, one of them is a blob containing a pdf file.
The table has an API page that is exposed with an odata web service
 
I use visual Studio pro and i would like to consume the web service and manage to download the file in the blob.
I downloaded Odata Connected service extension.
I manage to query the table,
I manage to get the Blob Selflink (that should contain the link to the file) but how to save it locally ?
Any suggestion ? 
 
B. regards
Fabrizio Fiammenghi
I have the same question (0)
  • Inge M. Bruvik Profile Picture
    1,105 Moderator on at
    What programming language are you using to consume the API page?
    C# or something else?
  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    Hi, there is a simple way to convert it to encoded text (Base64 String) in BC, and then after getting it, you convert it to PDF in your language.
    Some simple examples:
    How to import/create item picture from encoded text (Base64 String)
    https://yzhums.com/39193/
     
    How to convert Image (item picture) to encoded text (Base64 String) via AL
     
    Hope this helps.
    Thanks.
    ZHU
  • GrisuX Profile Picture
    49 on at
    Sorry, but probably i mis explained my self.
    From AL Side everything is ok, i manage to create the blobl, save in the table and download from the table.
     
    What i need is to be able to download the file from outside Business central, via web services
    Other info in the next reply
     
    Fabrizio 
  • GrisuX Profile Picture
    49 on at
    thanks for reply.
     
    I published the page using  the "web services" page in  Business central.
     
    From Visualstudio pro, in C# i mangae to connect to the web service and i manage to get record fields
     
    var serviceRoot = "http://bc.it:7058/BC220_TEST_PUB_CAP/ODataV4/";
    var context = new BC.NAV(new Uri(serviceRoot));
    context.BuildingRequest += Context_BuildingRequest;
    var data = context.GestionFileApi.Execute();
     
    the data variable containe the collection of the record of that page
     
    once i get the record i need, the filed 
    "Blobfile"  contains the and the property 
    BlobFile.SelfLink it seems contains the uri of the blob file
     
    i need to save it in a local file 
     
    is this the right way ?
    how to create the stream and save it ?
     
    there is a better way ?
     
    many thanks
    Fabrizio
     
     
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans