# 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
```al
 File.CreateOutStream(OutStream: OutStream)
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
File
Type: file-data-type
An instance of the file-data-type data type.
OutStream
Type: ../outstream/outstream-data-type
## Example
The following example uses the CreateOUTSTREAM method to export data from a table to an XML document. The code uses the file-create-method to create an XML file that is named CustXmlFile.xml in a folder that is named xmlData on drive C. The file-createoutstream-method opens a data stream to output the data from the table to the XML file. The ../xmlport/xmlport-export-method then exports the data and saves it at the specified location. The file-close-method closes the data stream. This example assumes that you have created a folder named xmlData on drive C.
```al
 var
    CustXmlFile: File;
    XmlStream: OutStream;
begin
    CustXmlFile.Create('C:\XmlData\Customer.xml');
    CustXmlFile.CreateOUTSTREAM(XmlStream);
    XMLPORT.Export(50002, XmlStream);
    CustXmlFile.Close;
end;

```
## Related information
file-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/file/file-createoutstream-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/file/file-createoutstream-method/
