CreateTemplates Method
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Security.CreateTemplates Method

Office 2007

Creates one or more security templates.

Namespace:  WebSvcSecurity
Assembly:  ProjectServerWebServices (in ProjectServerWebServices.dll)

[SoapDocumentMethodAttribute("", RequestNamespace = "", 
	ResponseNamespace = "", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void CreateTemplates(
	SecurityTemplatesDataSet templates


Type: WebSvcSecurity.SecurityTemplatesDataSet
Contains the information about one or more security templates.

The templates parameter must contain at least one SecurityTemplatesDataSet.SecurityTemplatesRow in the SecurityTemplates table that defines a new template. The SecurityTemplatesDataTable can contain multiple SecurityTemplatesRow objects. Project Server validates each SecurityTemplatesRow for the following:

  • Unique template name and GUID

There are three DataTable objects in a SecurityTemplatesDataSet. Only the SecurityTemplatesDataTable must contain data. The data tables are in order as follows:

  1. SecurityTemplates   Each row specifies the category GUID, name, and description. Only the GUID and name (WSEC_TMPL_UID and WSEC_TMPL_NAME) are required to create a security category.

  2. CategoryPermissions   Optional. Each row specifies the template GUID and category permission GUID, and sets Allow or Deny for the permission. For the category permissions, see the PSSecurityCategoryPermission structure.

  3. GlobalPermissions   Optional. Each row specifies the template GUID, the global permission GUID, and sets Allow or Deny for the permission. For the global permissions, see the PSSecurityGlobalPermission structure.

For examples of valid templates, click a template on the Manage Templates page in Project Web Access to see the fields and settings on the Add or Edit Template page.

Project Server Permissions




Manage Project Server security. Global permission.

The following example creates a security template and adds a global permission set to Allow for the group.

For additional information and a basic sample application for testing the Security class methods, see Using Security Methods in the PSI. You can add the following code to the test application.

 * Add this code to the sample application code in the article 
 * Using Security Methods in the PSI.

// Create a GUID for the new template.
Guid templateGuid = Guid.NewGuid();

// Specify basic template information.
SecurityWebSvc.SecurityTemplatesDataSet templateDs =
   new SecurityWebSvc.SecurityTemplatesDataSet();
SecurityWebSvc.SecurityTemplatesDataSet.SecurityTemplatesRow templateRow =
templateRow.WSEC_TMPL_NAME = "SDK Test Template";
templateRow.WSEC_TMPL_UID = templateGuid;
templateRow.WSEC_TMPL_DESC = "This is the SDK Test Template.";

// Specify a global permission for the template.
SecurityWebSvc.SecurityTemplatesDataSet.GlobalPermissionsRow globalPermissionRow =
globalPermissionRow.WSEC_TMPL_UID = templateGuid;
// Add a permission that applies to the group. 
// For example, add the "About Microsoft Office Project Server" permission.
globalPermissionRow.WSEC_FEA_ACT_UID =
globalPermissionRow.WSEC_ALLOW = true;

// Now that the rows are added to the relevant tables, create the template.
© 2015 Microsoft