The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
DOWNLOADFROMSTREAM Method (File)
Sends a file from the Dynamics 365 for Financials service to the client device. The client device is the device, such as a computer or phone, that accesses Dynamics 365.
[Ok :=] DOWNLOADFROMSTREAM(VarInstream, DialogTitle, ToFolder, ToFilter, ToFile)
An InStream that you want to use to send the data in a file on the Dynamics 365 for Financials service to a file on the client computer.
This parameter is not supported. The title is determined by the end-user's browser.
This parameter is not supported. By default, files are saved to the default download location that is configured in the end-user's browser.
This parameter is not supported.
The name to give the downloaded file. This is the default file name that is shown in the dialog box for downloading the file. This value, can be changed by the user.
Property Value/Return Value
If you omit this optional return value, then a run-time error occurs if the record cannot be found. If you include a return value, then you must handle any errors.
true if the file was downloaded; otherwise, false.
On devices that run Apple iOS, such as iPad, you can only download a file if the Apple iOS device on which you are downloading the file has an application that supports the file type.
The business logic runs on the computer that is running Dynamics 365 for Financials service and not on the client. Files are created on a Dynamics 365 service and not locally on the client computer. When you write code, you must consider where files are created.
We recommend that you use the methods in codeunit 419, File Management, to upload and download files.
This example requires that you create the following variables.
TempFile.CREATETEMPFILE(); TempFile.WRITE('abc'); TempFile.CREATEINSTREAM(NewStream); ToFileName := 'SampleFile.txt'; DOWNLOADFROMSTREAM(NewStream,'Export','','All Files (*.*)|*.*',ToFileName)