Security.CreateGroups Method

Creates one or more security groups.

Namespace:  [Security Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/Security.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/Security.asmx?wsdl

[SoapDocumentMethodAttribute("", RequestNamespace = "", 
	ResponseNamespace = "", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void CreateGroups(
	SecurityGroupsDataSet groups


Type: [Security Web service].SecurityGroupsDataSet
Contains the information about one or more security groups.

The groups parameter must contain at least one SecurityGroupsDataSet.SecurityGroupsRow in the SecurityGroups table that defines a new group. The SecurityGroupsDataTable can contain multiple SecurityGroupsRow objects. Project Server validates each SecurityGroupsRow for the following:

  • Unique group name and GUID

  • Existence of group users (if any)

There are five DataTable objects in a SecurityGroupsDataSet. Only the SecurityGroupsDataTable must contain data. The data tables are in order, as follows:

  1. SecurityGroups   Each row specifies the category GUID, name, and description. Only the GUID and name (WSEC_CAT_UID and WSEC_CAT_NAME) are required to create a security category.

  2. SecurityPrincipleCategoryRelations   Optional. Each row specifies the group GUID and the primary security category GUID. For the primary categories, see the PSSecurityCategory structure.

  3. CategoryPermissions   Optional. Each row specifies the group GUID and category permission GUID, and sets Allow or Deny for the permission. For information about the category permissions, see the PSSecurityCategoryPermission structure.

  4. GlobalPermissions   Optional. Each row specifies the group GUID and global permission GUID, and sets Allow or Deny for the permission. For information about the global permissions, see the PSSecurityGlobalPermission structure.

  5. GroupMembers   Optional. Each row specifies the group GUID and the resource GUID.

For examples of valid groups, click a group on the Manage Groups page in Project Web App, to see the fields and settings on the Add or Edit Group page.

Project Server Permissions




Allows a user to manage Project Server users and groups. Global permission.

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

For additional information and a complete sample application that creates one security category with a group, see Using Security Methods in the PSI.

using System;
using System.Net;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
CookieContainer cookiecontainer = new CookieContainer();
SecurityWebSvc.Security security = new SecurityWebSvc.Security();
security.Url = "http://ServerName/ProjectServerName/_vti_bin/psi/security.asmx";
security.CookieContainer = cookiecontainer;
security.Credentials = System.Net.CredentialCache.DefaultCredentials;
. . .
// Create a GUID for the new group.
Guid groupGuid = Guid.NewGuid();

// Specify basic group information.
SecurityWebSvc.SecurityGroupsDataSet groupDs =
   new SecurityWebSvc.SecurityGroupsDataSet();
SecurityWebSvc.SecurityGroupsDataSet.SecurityGroupsRow groupRow =
groupRow.WSEC_GRP_NAME = "SDK Test Group";
groupRow.WSEC_GRP_UID = groupGuid;
groupRow.WSEC_GRP_DESC = "This is the SDK Test Group.";

// Set the GUID for an existing resource.
Guid resourceUid = new Guid("a1fcbf91-e91d-44e2-a4a7-3b4b698cb984");

// Add the resource to the new group.
SecurityWebSvc.SecurityGroupsDataSet.GroupMembersRow groupMembersRow =
groupMembersRow.WSEC_GRP_UID = groupGuid;
groupMembersRow.RES_UID = resourceUid;

// Specify a global permission for the group.
SecurityWebSvc.SecurityGroupsDataSet.GlobalPermissionsRow globalPermRow =
globalPermRow.WSEC_GRP_UID = groupGuid;
// Add a permission that applies to the group. 
// For example, add the "About Microsoft Office Project Server" permission.
globalPermRow.WSEC_FEA_ACT_UID = 
globalPermRow.WSEC_ALLOW = true;

// Now that all the rows are added to the relevant tables,
// create the group.

. . .

Community Additions