Application.SaveToXml(String, Package, IDTSEvents) Application.SaveToXml(String, Package, IDTSEvents) Method

Definition

Saves the XML definition of a package to a file.

public:
 void SaveToXml(System::String ^ fileName, Microsoft::SqlServer::Dts::Runtime::Package ^ package, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ events);
public void SaveToXml (string fileName, Microsoft.SqlServer.Dts.Runtime.Package package, Microsoft.SqlServer.Dts.Runtime.IDTSEvents events);
Parameters
fileName
String String

The name of the file to save.

package
Package Package

The package object to save.

events
IDTSEvents IDTSEvents

An IDTSEvents object.

Examples

The following example saves the .dtsx package in XML format with the name myXMLPackage.dtsx.

static void Main(string[] args)  
        {  
            // The variable pkg points to the location  
            // of the ExecuteProcess package sample   
            // that is installed with the SSIS samples.  
            string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";  

            Application app = new Application();  
            Package p = app.LoadPackage(pkg, null);  
            app.SaveToXml("myXMLPackage.dtsx", p, null);  
        }  
Shared  Sub Main(ByVal args() As String)  
            ' The variable pkg points to the location  
            ' of the ExecuteProcess package sample   
            ' that is installed with the SSIS samples.  
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"   

            Dim app As Application =  New Application()   
            Dim p As Package =  app.LoadPackage(pkg,Nothing)   
            app.SaveToXml("myXMLPackage.dtsx", p, Nothing)  
End Sub  

Remarks

A package file normally has the extension, .dtsx.

If the file name specified in the fileName parameter does not exist, it will be created.

Applies to