The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.

EXPORT Method (XMLport)

Creates an XML data stream (XML document) and sends it to a chosen destination.


[Ok :=] XMLPORT.EXPORT(Number, OutStream[, Record])  


Type: Integer

The ID of the XMLport that you want to run.

Instead of the ID number, you can specify the name of the XMLport by using the following syntax: XMLPORT.EXPORT(XMLPORT::CustomerXMLport, XmlStream). <!--Links For more information, see Walkthrough: Exporting Data from Tables to XML Documents.-->

Type: ISequentialStream

Where the XMLport object will write the XML data stream.

Type: Record

The record to use in the XMLport. Any filters attached to the record will be used.

This parameter is optional. If this parameter is omitted, all records in the table are exported.


The following example exports data from a table to an XML document. The code uses the CREATE Method (File) to create an XML file named CustXmlFile.xml in a folder named xmlData on the C drive. 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 the C drive. This example requires that you create the following global variables.

Variable name DataType Subtype
CustXmlFile File Not applicable
XmlStream OutStream Not applicable
varXmlPort XMLport 50002

This inserts the name of the XMLport.
XMLPORT.EXPORT(50002, XmlStream);  

See Also

XMLport Data Type
XMLports object