none
InvalidGroupUIDRef....Why ?????? RRS feed

  • Question

  • SvcResource.ResourceDataSet resNewDs = new SvcResource.ResourceDataSet();
                        SvcResource.ResourceDataSet.ResourcesRow resourceRow = resNewDs.Resources.NewResourcesRow();
                        
                        NewResGuid = Guid.NewGuid();
                        resourceRow.RES_UID = NewResGuid;
                        resourceRow.RES_NAME = Name;
                        resourceRow.WRES_EMAIL = Email;
                        resourceRow.RES_INITIALS = Name.Substring(0, 1) +
                                            (Name.IndexOf(" ") > 0 ? Name.Substring(Name.IndexOf(" ") + 1, 1) : "");
                        resourceRow.RES_TYPE = (int)PSLibrary.Resource.Type.PureUser;
                        //resourceRow.RES_GROUP = "Project Managers";
                        resNewDs.Resources.AddResourcesRow(resourceRow);
                        Res.CreateResources(resNewDs, false, true);
                        System.Threading.Thread.Sleep(2000);
                        // Upgrade user using the Authorization dataset,...
                        SvcResource.ResourceAuthorizationDataSet resourceAuthDs = new SvcResource.ResourceAuthorizationDataSet();
                        SvcResource.ResourceAuthorizationDataSet.ResourcesRow resourceAuthRow = resourceAuthDs.Resources.NewResourcesRow();
                        resourceAuthRow.RES_UID = NewResGuid;
                        if (NTAccountName.Contains("aspnetsqlmembershipprovider"))
                        {
                            resourceAuthRow.RES_IS_WINDOWS_USER = false;
                        }
                        else
                        {
                            resourceAuthRow.RES_IS_WINDOWS_USER = true;
                        }
                        resourceAuthRow.WRES_ACCOUNT = NTAccountName;                    
                        resourceAuthDs.Resources.AddResourcesRow(resourceAuthRow);
                        Res.SetResourceAuthorization(resourceAuthDs);
                        System.Threading.Thread.Sleep(2000);
                        //conPublished= new SqlConnection(p.ReadXML("PublishedCon"));
                        //if (conPublished.State == ConnectionState.Closed) conPublished.Open();
                        //SqlCommand cmd = new SqlCommand("INSERT INTO MSP_WEB_SECURITY_GROUP_MEMBERS (WRES_GUID,WSEC_GRP_GUID) VALUES ('" + NewResGuid + "','" + p.ReadXML("WSEC_GRP_GUID") + "')", conPublished);
                        //cmd.ExecuteNonQuery();
                        //conPublished.Close();
                        SvcSecurity.SecurityGroupsDataSet secGpDS = new SvcSecurity.SecurityGroupsDataSet();
                        SvcSecurity.SecurityGroupsDataSet.SecurityGroupsRow groupDs = null;
                        secGpDS = Sec.ReadGroupList(); //Read all the Groups availabl in the Project Server 2010
                        Guid GroupUID = new Guid();
                        foreach (SvcSecurity.SecurityGroupsDataSet.SecurityGroupsRow ds in secGpDS.SecurityGroups)
                        {
                            if (ds.WSEC_GRP_NAME == "Project Managers")
                            {
                                groupDs = ds;
                                break;
                            }
                        }
                        //Assign the Resource respective user to Project Managers Group and Move Further...
                        SvcSecurity.SecurityGroupsDataSet dsGd = new SvcSecurity.SecurityGroupsDataSet();
                        SvcSecurity.SecurityGroupsDataSet.GroupMembersRow securityGroupMembersRow = dsGd.GroupMembers.NewGroupMembersRow();
                        securityGroupMembersRow.RES_UID = NewResGuid;
                        securityGroupMembersRow.WSEC_GRP_UID = new Guid("14D044FC-86D6-4271-AF83-39AD5F139013");
                        dsGd.GroupMembers.AddGroupMembersRow(securityGroupMembersRow);
                        Sec.SetGroups(dsGd);
                        System.Threading.Thread.Sleep(2000);


    Thanks, Parth

    Tuesday, November 20, 2012 3:35 PM