File.CreateOutStream(OutStream) Method

Version: Available or changed with runtime version 1.0.

Creates an OutStream object for a file. This enables you to export or write data to the file.

Note

This method is supported only in Business Central on-premises.

Syntax

 File.CreateOutStream(OutStream: OutStream)

Note

This method can be invoked without specifying the data type name.

Parameters

File
 Type: File
An instance of the File data type.

OutStream
 Type: OutStream

Example

The following example uses the CreateOUTSTREAM method to export data from a table to an XML document. The code uses the Create Method (File) to create an XML file that is named CustXmlFile.xml in a folder that is named xmlData on drive C. The CreateOUTSTREAM Method (File) opens a data stream to output the data from the table to the XML file. The Export Method (XMLport) then exports the data and saves it at the specified location. The Close Method (File) closes the data stream. This example assumes that you have created a folder named xmlData on drive C.

 var
    CustXmlFile: File;
    XmlStream: OutStream;
begin
    CustXmlFile.Create('C:\XmlData\Customer.xml');  
    CustXmlFile.CreateOUTSTREAM(XmlStream);  
    XMLPORT.Export(50002, XmlStream);  
    CustXmlFile.Close;  
end;

File Data Type
Get Started with AL
Developing Extensions