Notifications
Announcements
No record found.
Hi community,
I'm working with Business Central On-Premise version 25.1 (Platform 25.0.25866.0 + Application 25.1.25873.25900), in a hybrid code environment.
I already have a fully developed embedded PDF viewer (not the lite version), and until now I’ve been loading documents from the database using Document Attachment.
Document Attachment
Now I want to change the approach and read PDF files directly from a local shared folder, for example: \\SRV_NAME\FOLDER_NAME , without storing them in the database.
\\SRV_NAME\FOLDER_NAME
My goal is to:
TempBlob
The Business Central server has access to the shared folder, and the service runs under a user with the necessary permissions.
I don’t yet have the code to read from disk, and I’m not sure how to do it properly in AL (especially in OnPrem extensions). Could someone help me implement this flow step-by-step, with working AL code compatible with OnPrem?
Thanks in advance!
procedure LoadPDFIntoTempBlob(UNCPath: Text; var TempBlob: Record TempBlob): Boolean var InStream: InStream; FileManagement: Codeunit "File Management"; TempFile: Text; begin // Confirm path exists and ends with ".pdf" if not FileManagement.ServerFileExists(UNCPath) then begin Error('File not found: %1', UNCPath); end; if not StrEndsWith(LowerCase(UNCPath), '.pdf') then Error('File must be a PDF: %1', UNCPath); // Open the file as InStream FileManagement.ServerFileToInStream(UNCPath, InStream); // Prepare TempBlob TempBlob.Init(); TempBlob.Blob.CreateInStream(InStream); TempBlob.Insert(); exit(true); end;
Hi, good day I hope this can help you, and give you some hints.
How to save a file to a shared folder on the network Business Central
Creating a local drive mapped with an Azure File Share for your files in the cloud – Stefano Demiliani
(1) Store File from Business Central on Local Static Folder Path without Manual Intervention. | LinkedIn
Best Regards Gerardo
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
OussamaSabbouh 2,135
YUN ZHU 733 Super User 2025 Season 2
Sumit Singh 612