共用方式為


Managing Packages and Folders Programmatically

新增: 2006 年 4 月 14 日

As you work programmatically with Integration Services packages, you may want to determine whether an individual package or folder exists, or to manage the folders in which packages are stored. The Application class of the Microsoft.SqlServer.Dts.Runtime namespace provides a variety of methods to satisfy these requirements.

In This Topic

  • Determining whether a package or folder exists
  • Managing packages and folders
    • Removing a package
    • Creating a folder
    • Removing a folder
    • Renaming a folder

For information about enumerating available packages, see Enumerating Available Packages Programmatically. For information about loading and running saved packages programmatically, see Loading and Running a Local Package Programmatically and Loading and Running a Remote Package Programmatically.

All the methods discussed in this topic require a reference to the Microsoft.SqlServer.ManagedDTS assembly. After you add the reference in a new project, import the Microsoft.SqlServer.Dts.Runtime namespace with a using or Imports statement.

ms403367.note(zh-tw,SQL.90).gif重要事項:
The methods of the Application class for working with the SSIS Package Store support only ".", localhost, or the server name for the local server. You cannot use "(local)".

Determining Whether a Package or Folder Exists

To determine programmatically whether a saved package exists, call one of the following methods before attempting to load and run the package:

Storage Location Method to Call

SSIS Package Store

ExistsOnDtsServer

SQL Server

ExistsOnSqlServer

To determine programmatically whether a folder exists, call one of the following methods before attempting to list the packages stored in the folder, :

Storage Location Method to Call

SSIS Package Store

FolderExistsOnDtsServer

SQL Server

FolderExistsOnSqlServer

Back to top

Managing Packages and Folders

The Application class of the Microsoft.SqlServer.Dts.Runtime namespace provides additional methods for managing packages and the folders in which they are stored.

Removing a Package

To remove a saved package programmatically, call one of the following methods:

Storage Location Method to Call

SSIS Package Store

RemoveFromDtsServer

SQL Server

RemoveFromSqlServer

Back to top

Creating a Folder

To create a storage folder programmatically, call one of the following methods:

Storage Location Method to Call

SSIS Package Store

CreateFolderOnDtsServer

SQL Server

CreateFolderOnSqlServer

Back to top

Removing a Folder

To remove a storage folder programmatically, call one of the following methods:

Storage Location Method to Call

SSIS Package Store

RemoveFolderFromDtsServer

SQL Server

RemoveFolderFromSqlServer

Back to top

Renaming a Folder

To rename a storage folder programmatically, call one of the following methods:

Storage Location Method to Call

SSIS Package Store

RenameFolderOnDtsServer

SQL Server

RenameFolderOnSqlServer

Back to top

請參閱

工作

Enumerating Available Packages Programmatically

其他資源

管理 Integration Services 封裝

說明及資訊

取得 SQL Server 2005 協助