다음을 통해 공유


GetPackageInfos 메서드

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.

네임스페이스:  Microsoft.SqlServer.Dts.Runtime
어셈블리:  Microsoft.SqlServer.ManagedDTS.dll의 Microsoft.SqlServer.ManagedDTS

구문

‘선언
Public Function GetPackageInfos ( _
    strFolder As String, _
    serverName As String, _
    serverUserName As String, _
    serverPassword As String _
) As PackageInfos
‘사용 방법
Dim instance As Application
Dim strFolder As String
Dim serverName As String
Dim serverUserName As String
Dim serverPassword As String
Dim returnValue As PackageInfos

returnValue = instance.GetPackageInfos(strFolder, _
    serverName, serverUserName, serverPassword)
public PackageInfos GetPackageInfos(
    string strFolder,
    string serverName,
    string serverUserName,
    string serverPassword
)
public:
PackageInfos^ GetPackageInfos(
    String^ strFolder, 
    String^ serverName, 
    String^ serverUserName, 
    String^ serverPassword
)
member GetPackageInfos : 
        strFolder:string * 
        serverName:string * 
        serverUserName:string * 
        serverPassword:string -> PackageInfos 
public function GetPackageInfos(
    strFolder : String, 
    serverName : String, 
    serverUserName : String, 
    serverPassword : String
) : PackageInfos

매개 변수

  • strFolder
    형식: 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.
  • serverUserName
    형식: System. . :: . .String
    The SQL Server login name if you use SQL Server Authentication to log into the server; otherwise, nullNothingnullptrunitnull 참조(Visual Basic에서는 Nothing) if you use Windows Authentication.
  • serverPassword
    형식: System. . :: . .String
    The SQL Server login password if you use SQL Server Authentication to log into the server; otherwise, nullNothingnullptrunitnull 참조(Visual Basic에서는 Nothing) 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 프로그래밍 방식으로 패키지 및 폴더 관리.

예제

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);
}
Dim app As Application =  New Application() 
Dim pInfos As PackageInfos =  app.GetPackageInfos("\\","yourserver",Nothing,Nothing) 
For Each pInfo As PackageInfo In pInfos
    Console.WriteLine("Name: {0}", pInfo.Name)
Next

Sample Output:

Name: Maintenance Plans