# File.CreateInStream(InStream) Method
> Version: _Available or changed with runtime version 1.0._
Creates an InStream object for a file. This enables you to import or read data from the file.
> NOTE
> This method is supported only in Business Central on-premises.
## Syntax
```al
 File.CreateInStream(InStream: InStream)
```
> 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.
InStream
Type: ../instream/instream-data-type
## Example
The following example imports data from an XML document to a table. The code uses the file-open-method to open the XML document named NewCustomer.xml from a folder named Import on the C drive. The file-createinstream-method creates a data stream to get the data from the XML document into the table. The ../xmlport/xmlport-import-method then imports, parses the data, and adds it as a record to the table by using an XMLport \(50004\). The file-close-method then closes the data stream. This example assumes that you have created a NewCustomer.xml file in a folder that is named Import on the C drive and you have created an XMLport and given it ID 50004.
```
 var
    ImportXmlFile: File;
    XmlINStream: InStream;
begin
    ImportXmlFile.Open('C:\Import\NewCustomer.xml');
    ImportXmlFile.CreateInStream(XmlINStream);
    XMLPORT.Import(50004, XmlINStream);
    ImportXmlFile.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-createinstream-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-createinstream-method/
