GetPackagePath Method

DtsProperty.GetPackagePath Method (Object)


Returns a String that contains the relative path to the location of the specified package.

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

public string GetPackagePath(
	object o


Type: System.Object

An object that contains the package.

Return Value

Type: System.String

A String that contains the relative path to the location of the specified package.

The following code example shows different ways to retrieve the package path. One value is returned from the GetPackagePath method, using the GetPackagePath on the first property in the DtsProperties collection. The other package path returned is from the GetPackagePath that is implemented directly on the Package. The output shows the values returned from the methods.

// other Using statements here...
using Microsoft.SqlServer.Dts.Runtime;
namespace DtsPropertiesTesting
class Program

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

            Application application = new Application();
            Package package = application.LoadPackage(packageFile, null);

            // Retrieve the information from the Properties collection.
            // Each item in the collection represents a property on the
            // Package object.

            DtsProperties properties = package.Properties;

            String propertyName;
            DTSPropertyKind propertyKind;
            String packagePath;
            TypeCode propertyType;

            foreach (DtsProperty property in properties)
                propertyType = property.Type;
                propertyName = property.Name;
                propertyKind = property.PropertyKind;
                packagePath = property.GetPackagePath(package);
                Console.WriteLine("Property Type: {0}, Property Name: {1}, Property Kind: {2}, Package Path: {3} ", propertyType, propertyName, propertyKind, packagePath);

Sample Output:

Package path = \Package

Package properties path = \Package.CertificateContext

Package properties path = \Package.CertificateObject

Package properties path = \Package.CheckpointFileName

Return to top
© 2015 Microsoft