DOWNLOADFROMSTREAM Function (File)

Sends a file from a Microsoft Dynamics NAV Server to a RoleTailored client.


[Ok :=] DOWNLOADFROMSTREAM(VarInstream, DialogTitle, ToFolder, ToFilter, ToFile)

Parameters

VarInStream

Type: variant

An InStream that you want to use to send the data in a file on Microsoft Dynamics NAV Server to a file on a RoleTailored client.

DialogTitle

Type: text

The title that you want to display on the dialog box.

ToFolder

Type: text

The name of the folder that is displayed in the dialog box.

ToFilter

Type: text

The type of file that is displayed in the dialog box.

ToFile

Type: variant

The name of the file that is displayed in the dialog box.

Type: Boolean

If you omit this optional return value, a run-time error occurs if the record cannot be found. If you include a return value, it is assumed that you will handle any errors.

true if the file was downloaded; otherwise, false.

In the new architecture the business logic is run on the middle-tier server and not on the client.

This means that in Microsoft Dynamics NAV, files are created on the Microsoft Dynamics NAV service and not locally on the client computer as is the case in the Classic client. When you write code for the application, you must therefore remember where the files are created.

Use UPLOAD Function (File) and UPLOADINTOSTREAM Function (File) to send a file from a RoleTailored client to a Microsoft Dynamics NAV service.

Use DOWNLOAD Function (File) and DOWNLOADFROMSTREAM Function (File) to send a file from a Microsoft Dynamics NAV service to a RoleTailored client.

We recommend that you use the functions in Codeunit 419, 3-Tier Automation Mgt., to upload and download files.

This example requires that you create the following variables.

Name DataType

TempFile

File

NewStream

InStream

ToFileName

File

TempFile.CREATEINSTREAM(NewStream);
ToFileName := 'SampleFile.txt';
DOWNLOADFROMSTREAM(NewStream,’ Export’,'', ’ All Files (*.*)|*.*’,ToFileName)

Community Additions

ADD
Show: