Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Application.LoadPackage Method (String, IDTSEvents)

Loads a Package from the file system.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public Package LoadPackage(
	string fileName,
	IDTSEvents events
)

Parameters

fileName
Type: System.String
The name of the file that contains the package to load.
events
Type: Microsoft.SqlServer.Dts.Runtime.IDTSEvents
An IDTSEvents interface.

Return Value

Type: Microsoft.SqlServer.Dts.Runtime.Package
The package that was loaded.

The following code example loads a package from the file system, and then returns several properties for the package.

class ApplicationTests
    {
        static void Main(string[] args)
        {
            // The variable pkg points to the location of the
            // ExecuteProcess package sample 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);
           // Now that the package is loaded, we can query on
           // its properties.
            int n = p.Configurations.Count;
            DtsProperty  p2 = p.Properties["VersionGUID"];
            DTSProtectionLevel pl = p.ProtectionLevel;

            Console.WriteLine("Number of configurations = " + n);
            Console.WriteLine("VersionGUID = " + p2);
            Console.WriteLine("ProtectionLevel = " + pl);
        }
    }

Sample Output:

Number of configurations = 0

VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty

ProtectionLevel = EncryptSensitiveWithUserKey

Community Additions

ADD
Show:
© 2015 Microsoft