Managing Package Roles Programmatically

As you work programmatically with Integration Services packages, you may want to determine which roles are available to apply to packages, or to determine or set the roles applied to an individual package. The Application class of the Microsoft.SqlServer.Dts.Runtime namespace provides a variety of methods to satisfy these requirements.

Roles apply only to packages stored in the SQL Server msdb database. For more information about package roles, see Using Integration Services Roles.

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 by using a using or Imports statement.

Important

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 Which Roles Are Available

To determine which roles are available for the packages stored on a particular server, call the GetDtsServerRoles method of the Application class.

Determining Which Roles Are Assigned

To determine which roles have already been assigned to a particular package, call the GetPackageRoles method. To assign roles to a package, call the SetPackageRoles method.

Integration Services icon (small) Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.