Dynamics 365 Business Central: previewing a file from AL.

With Dynamics 365 Business Central 2025 Wave 1 release (version 26) and the new AL Language extension version 15, it will be possible to preview a file directly in the web client (no need to use control add-ins anymore) without downloading it first.

Doing that is very easy. The new runtime 15 adds the following method to the File object:

File.ViewFromStream(Stream: InStream, FileName: String [, AllowDownloadAndPrint: Boolean]);

With the below code, you can read a file (for example a PDF) and preview it in the client:

This is the PDF rendered in preview mode in the client. Please note that you can also enable or disable the possibility to download and print it:

If the loaded file is not supported for previewing, an error message will be displayed:

Starting from Dynamics 365 Business Central version, this feature is used in various areas like document attachments and incoming documents to automatically preview an uploaded document:

Also a new method is available for Dynamics 365 Business Central on-premises:

File.View(FilePath: String [, AllowDownloadAndPrint: Boolean]);

but who cares about non SaaS-compliant code, isn’t it? 😜

Original Post https://demiliani.com/2025/03/10/dynamics-365-business-central-previewing-a-file-from-al/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...