Export (0) Print
Expand All

Application.GetPackageInfos Method

Gets a PackageInfos collection that contains the packages stored in an instance of SQL Server, within the specified logical folder, by using the server name, user name, and password.

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

public PackageInfos GetPackageInfos(
	string strFolder,
	string serverName,
	string serverUserName,
	string serverPassword
)

Parameters

strFolder
Type: System.String
The logical folder that contains the packages you want to enumerate. If you want package information from the File System folder in the SSIS Package Store, use the GetDtsServerPackageInfos method. The logical folders in which packages are stored within MSDB can be created from the Stored Packages\MSDB node in Management Studio, by the dtutil.exe command prompt utility, or by the CreateFolderOnSqlServer method.
serverName
Type: System.String
The name of the SQL Server instance where the packages reside.
serverUserName
Type: System.String
The SQL Server login name if you use SQL Server Authentication to log into the server; otherwise, null if you use Windows Authentication.
serverPassword
Type: System.String
The SQL Server login password if you use SQL Server Authentication to log into the server; otherwise, null if you use Windows Authentication.

This method bypasses the SSIS Service and connects directly to an instance of SQL Server to gather information about packages stored in the MSDB database. It returns a PackageInfo object for each package stored in the specified logical folder. From the PackageInfo object, you can obtain the package's name, description, creation date, version, and additional information.

For more information, see Managing Packages and Folders Programmatically.

The following code example retrieves the collection from the application object and iterates over each object in the collection, printing its description.

Application app = new Application();
PackageInfos pInfos = app.GetPackageInfos("\\", "yourserver", null, null);
foreach (PackageInfo pInfo in pInfos)
{
    Console.WriteLine("Name: {0}", pInfo.Name);
}

Sample Output:

Name: Maintenance Plans

Community Additions

ADD
Show:
© 2014 Microsoft