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 Function GetPackagePath As String

Return Value

Type: System.String

A String that contains the path to the package.

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

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime

Namespace LogProvider_Expression_Tests
    Class Program
        Shared  Sub Main(ByVal args() As String)
            ' 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.

            Dim mySample As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx" 

            ' Create the Application, and load the sample.
            Dim app As Application =  New Application() 
            Dim pkg As Package =  app.LoadPackage(mySample,Nothing) 

            ' Get the LogProviders collection.
            Dim logProvs As LogProviders =  pkg.LogProviders 

            ' Get the "SSIS log provider for Text files"
            ' provider from the collection.
            Dim textLogProv As LogProvider =  logProvs("SSIS log provider for Text files") 

            ' Get the package path from the log provider.
            Dim pkgPath As String =  textLogProv.GetPackagePath() 
            Console.WriteLine("Package path: {0}", pkgPath)
        End Sub
    End Class
End Namespace

Sample Output:

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

Return to top