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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

FileManagement functions in AL

(0) ShareShare
ReportReport
Posted on by

Hi Team,

While moving our C/Al Code to AL extension for  App source. I found some FileManagement code-unit functions which are defined as Internal So is there any reference for guidance.

Now am facing issue with function FileManagement.MoveFile(). Can any one suggest how to resolve this.

Thank you!

Categories:
  • Suggested answer
    I Gusti Made Ari Profile Picture
    3,608 on at

    for SaaS, you need to use Stream to upload or download file .

    For onPremise you still can use it but in app.json you need to change target to "Internal"

  • Community Member Profile Picture
    on at

    Hi,

    Can you provide some example code in AL....

    I need to move the file from Server to Client location.....

    I have only file path in server..

    Thank you!

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    In a SaaS environment, you don't have a file system on the server. You've only streams and you should use DownloadFromStreams. For example:

    procedure CreateTxtFile(FileName: Text)

    var

       InStr: InStream;

       OutStr: OutStream;

       tmpBlob: Record TempBlob temporary;

       CR: char;

       LF: char;

    begin

       CR := 13;

       LF := 10;

       tmpBlob.Blob.CreateOutStream(OutStr);        

       OutStr.WriteText('First line'+ CR + LF);

       OutStr.WriteText('Second line'+ CR + LF);

       OutStr.WriteText('Third line'+ CR + LF);        

       tmpBlob.Blob.CreateInStream(InStr);

       DownloadFromStream(InStr, '', '', '', FileName);

    end;

    If your extension targets only the on-premise world (target = internal) you've all the File methods available.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans