Export (0) Print
Expand All

LogProvider.GetPackagePath Method

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

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

public string GetPackagePath()

Return Value

Type: System.String
A String that contains the path to the package.

Implements

IDTSPackagePath.GetPackagePath()

The following code sample returns the package path from the log provider.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace LogProvider_Expression_Tests
{
    class Program
    {
        static void Main(string[] args)
        {
            // The package is one of the SSIS Samples. The package was
            // modified to log to the SSIS log provider for Text files
            // and saved before loading into this code.

            string mySample = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";

            // Create the Application, and load the sample.
            Application app = new Application();
            Package pkg = app.LoadPackage(mySample, null);

            // Get the LogProviders collection.
            LogProviders logProvs = pkg.LogProviders;

            // Get the "SSIS log provider for Text files"
            // provider from the collection.
            LogProvider textLogProv = logProvs["SSIS log provider for Text files"];
     
            // Get the package path from the log provider.
            String pkgPath = textLogProv.GetPackagePath();
            Console.WriteLine("Package path: {0}", pkgPath);
        }
    }
}

Sample Output:

Package path: \Package.LogProviders[{2A89B1C0-E01E-4E1B-89E3-02DDFF291D70}]

Community Additions

ADD
Show:
© 2014 Microsoft