none
Project Server 2010 PSI - Add users to a security group RRS feed

  • Question

  • I'm trying to add user to a existing group but I Have an error "SecurityInvalidGroupUidRef" on security.SetGroups(groupDs)

    . Here my code :

     

    Dim GroupList = security.ReadGroupList()
    Dim Group = DirectCast(GroupList.Tables("SecurityGroups"), 
    ObtenirResource.WebSvcSecurity.SecurityGroupsDataSet.SecurityGroupsDataTable)
    
    Dim Ligne As WebSvcSecurity.SecurityGroupsDataSet.SecurityGroupsRow
    
    Dim GroupGuid As Guid = Guid.Empty
    For i As Integer = 0 To Group.Count
       Ligne = Group.Rows(i)
       If Ligne.WSEC_GRP_NAME = "projects managers" Then
         GroupGuid = Ligne.WSEC_GRP_UID
         Exit For
       End If
    Next
    
    If GroupGuid <> Guid.Empty Then
       Dim groupDs As WebSvcSecurity.SecurityGroupsDataSet =
             New WebSvcSecurity.SecurityGroupsDataSet()
    
       Dim groupMembersRow As WebSvcSecurity.SecurityGroupsDataSet.GroupMembersRow =
             groupDs.GroupMembers.NewGroupMembersRow()
       groupMembersRow.WSEC_GRP_UID = GroupGuid
    
       groupMembersRow.RES_UID = p_GuidUser
       groupDs.GroupMembers.AddGroupMembersRow(groupMembersRow)
    
       security.SetGroups(groupDs)
    
    End If
    
    

    Thanks for your help.
     

    Friday, July 15, 2011 1:14 PM

Answers

  • Hello Mop55,

    SecurityInvalidGroupUidRef error is the Invalid security group GUID, so when you try to get the Project Managers security group uid, please make sure that you get the correct security group GUID. Try debugging the code & see what is the Guid for the Project Managers group which your code is returning? use "Projects Managers" instaed of "projects managers" & see that helps.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    • Marked as answer by Mop55 Monday, July 18, 2011 12:33 PM
    Monday, July 18, 2011 6:33 AM

All replies

  • Hello Mop55,

    SecurityInvalidGroupUidRef error is the Invalid security group GUID, so when you try to get the Project Managers security group uid, please make sure that you get the correct security group GUID. Try debugging the code & see what is the Guid for the Project Managers group which your code is returning? use "Projects Managers" instaed of "projects managers" & see that helps.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    • Marked as answer by Mop55 Monday, July 18, 2011 12:33 PM
    Monday, July 18, 2011 6:33 AM
  • Hello Mop55,

    SecurityInvalidGroupUidRef error is the Invalid security group GUID, so when you try to get the Project Managers security group uid, please make sure that you get the correct security group GUID. Try debugging the code & see what is the Guid for the Project Managers group which your code is returning? use "Projects Managers" instaed of "projects managers" & see that helps.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82


    Hi,

    Yes I a have an error on "Projects Manager" but my other error are on guid, my groupMemberRow are empty instead of group row.

    Thank you for your help :)

    Monday, July 18, 2011 12:33 PM
  • I'm having same problem. I checked printing groupMembersRow object before setting and its not empty. Any ideas?

       objSecurity.Credentials = CredentialCache.DefaultCredentials;
    
                    srvSecurity.SecurityGroupsDataSet secutiryAuthDs = new srvSecurity.SecurityGroupsDataSet();
                    srvSecurity.SecurityGroupsDataSet.GroupMembersRow securityAuthRow = secutiryAuthDs.GroupMembers.NewGroupMembersRow();
                  
                    securityAuthRow.WSEC_GRP_UID = SecurityGroupGuid;
                 //   securityAuthRow.WSEC_GRP_UID = new Guid("13ea50ff-dcd1-455a-844a-4df08af90808");
                    
                    securityAuthRow.RES_UID = ResourceGuid;
                    Console.WriteLine("testing");
                    Console.WriteLine(securityAuthRow.WSEC_GRP_UID.ToString());
    
                    secutiryAuthDs.GroupMembers.AddGroupMembersRow(securityAuthRow);
                    objSecurity.SetGroups(secutiryAuthDs);


    Wednesday, February 29, 2012 8:36 AM
  • Hi 

    Any update on the above issue. I am having the same issue as well. 

    The securityGroupGUID is correct as I have checked with the database as well. But it give me "SecurityInvalidGroupUidRef" error on calling SetGroups.

    Please respond.

    Friday, November 9, 2012 10:25 AM
  • i am having the same problem, any updates on the same??

    Thanks, Parth

    Tuesday, November 20, 2012 5:31 PM
  • To anyone that cares,

    The reason why this call fails is because the resource you are trying to add does not have the permission "Resource can logon to Project Server" checked. I had this same issue until I made that resource able to logon to project server.

    But now I have a question, How do you check from code, if a resource has this checked or not? I can't find the property...


    120811049008

    Friday, April 26, 2013 2:19 PM
  • I have the same problem, but I'm sure that resource has checked the "Resource can logon to Project Server". Does anyone have ideas about this error?
    Tuesday, July 16, 2013 3:51 AM
  • Sorry.

    Finally I found there is one mistake about group guid in code.

    Following is code I'm using.

    Hope it helps.

    msprojectSecurity.Security msprojectSecurity = new msprojectSecurity.Security();
    msprojectSecurity.Credentials = CredentialCache.DefaultCredentials;
    
    using (msprojectSecurity.SecurityGroupsDataSet groupDs = msprojectSecurity.ReadGroup(SecurityGroupGuid))
    {
      if (groupDs.GroupMembers.FindByRES_UIDWSEC_GRP_UID(ResourceGuid, SecurityGroupGuid) == null)
      {
        msprojectSecurity.SecurityGroupsDataSet.GroupMembersRow groupMembership = groupDs.GroupMembers.NewGroupMembersRow();
        groupMembership.RES_UID = ResourceGuid;
        groupMembership.WSEC_GRP_UID = SecurityGroupGuid;
        groupDs.GroupMembers.AddGroupMembersRow(groupMembership);
        msprojectSecurity.SetGroups(groupDs);
        isUpdate = true;
      }
    }

    Tuesday, July 16, 2013 6:33 AM