Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Unable to Create a Group

$
0
0

Hi All,

I'm trying to create a group using the following code

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 =
   groupDs.SecurityGroups.NewSecurityGroupsRow();
groupRow.WSEC_GRP_NAME = "SDK Test Group";
groupRow.WSEC_GRP_UID = groupGuid;
groupRow.WSEC_GRP_DESC = "This is the SDK Test Group.";
groupDs.SecurityGroups.AddSecurityGroupsRow(groupRow);

// 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 =
   groupDs.GroupMembers.NewGroupMembersRow();
groupMembersRow.WSEC_GRP_UID = groupGuid;
groupMembersRow.RES_UID = resourceUid;
groupDs.GroupMembers.AddGroupMembersRow(groupMembersRow);

// Specify a global permission for the group
SecurityWebSvc.SecurityGroupsDataSet.GlobalPermissionsRow globalPermRow =
   groupDs.GlobalPermissions.NewGlobalPermissionsRow();
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 = 
   PSLibrary.PSSecurityGlobalPermission.AboutMicrosoftOfficeProjectServer;
globalPermRow.WSEC_ALLOW = true;
groupDs.GlobalPermissions.AddGlobalPermissionsRow(globalPermRow);

// Now that all the rows are added to the relevant tables,
// create the group.
security.CreateGroups(groupDs);

Well, the source of the code being the link : http://msdn.microsoft.com/en-us/library/websvcsecurity.security.creategroups%28v=office.12%29.aspx

However, I'm getting "ProjectServerError(s) LastError=GeneralInvalidOperation". I have tried the same code without adding resources/permissions , just basic info of a group,  but no luck.

Any idea of what this error is about?

Thanks in advance,

Ritesh Gade



Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>