Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
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.

Security.CreateGroups Method

Office 2007

Creates one or more security groups.

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

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/Security/CreateGroups", RequestNamespace = "http://schemas.microsoft.com/office/project/server/webservices/Security/", 
	ResponseNamespace = "http://schemas.microsoft.com/office/project/server/webservices/Security/", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void CreateGroups(
	SecurityGroupsDataSet groups


Type: WebSvcSecurity.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 the 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 principal security category GUID. For the principal 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 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 the global permissions, see the PSSecurityGlobalPermission structure.

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

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

Project Server Permissions




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

© 2015 Microsoft