none
Add Security Group Members Error RRS feed

  • Question

  • Hi,

    I'm trying to add resources to security groups using PSI but I'm getting the following error when saving the security groups dataset:

    ================================================================

    Message: ProjectServerError(s) LastError=GeneralUnhandledException Instructions: Pass this into PSClientError constructor to access all error information

    Stack Trace: 

    Server stack trace: 

       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

     

    Exception rethrown at [0]: 

       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

       at SvcSecurity.Security.SetGroups(SecurityGroupsDataSet group)

       at SvcSecurity.SecurityClient.SetGroups(SecurityGroupsDataSet group)

       at SCTAImportUsers_WebPart.VisualWebPart1.VisualWebPart1UserControl.ImportUsers(Object sender, EventArgs e)

    Source: mscorlib

    Inner Exception: 

    =========================================================================

    Here is the code I'm using to add security group members:

    foreach (SearchResult sr in selectedResources)
                    {
    
    
                        if (!string.IsNullOrEmpty(sr.SecurityGroups))
                        {
    
                            string[] resourceSecurityGroups = sr.SecurityGroups.Split(new char[] { Convert.ToChar(",") });
    
                            for (int index = 0; index < resourceSecurityGroups.Length; index++)
                            {
    
                                Guid WSEC_GRP_UID = new Guid(securityGroupsDataSet.SecurityGroups.Select(securityGroupsDataSet.SecurityGroups.WSEC_GRP_NAMEColumn.ColumnName + " = '" + resourceSecurityGroups[index].Trim() + "'")
                                    [0][securityGroupsDataSet.SecurityGroups.WSEC_GRP_UIDColumn.ColumnName].ToString());
    
                                SvcSecurity.SecurityGroupsDataSet.GroupMembersRow member = securityGroupsDataSet.GroupMembers.NewGroupMembersRow();
    
                                member.RES_UID = sr.RES_UID;
                                member.WSEC_GRP_UID = WSEC_GRP_UID;
    
                                securityGroupsDataSet.GroupMembers.AddGroupMembersRow(member);                            
    
                            }
                        }
                    }
    
                    securityClient.SetGroups(securityGroupsDataSet);
    


    Wednesday, October 19, 2011 11:36 AM

All replies

  • the error above is to general

    as requested above, you should us PSClientError object to get more details on this error

     

    see code sample here: http://msdn.microsoft.com/en-us/library/microsoft.office.project.server.library.psclienterror(v=office.12).aspx

     

     


    Assaf
    Thursday, October 20, 2011 7:03 PM
  • Thanks for your reply.

    I already used that code but the exception is not even catch as SoapException.

    Sunday, October 23, 2011 11:37 AM
  • More details....

    I'm using Visual Web Part to add the security group members. Also, I tried the same code from Windows Application and it worked just fine!

    Sunday, October 23, 2011 1:47 PM
  • What type of exception is actually thrown?

    System.Exception?

    There should be a full message looking like this: "System.Web.Services.Protocols.SoapException: ProjectServerError(s) LastError=GeneralUnhandledException Instructions: Pass this into PSClientError constructor to access all error information"

     

    Anyways it looks like a possible credentials issue, which is a common difference between windows apps and web apps.

    See if using a hard coded network credentials of a domain user will work (instead of using default credentials) on the securityClient object

     

     


    Assaf
    Sunday, October 23, 2011 5:48 PM