Exemplo n.º 1
0
        public void getSecurityRoleFromCRM(SecurityRoleBase mySecurityRole)
        {
            /*
               using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(CRMCredentials.OrganizationUri, null, CRMCredentials.Credentials, null))
               {
               IOrganizationService webservice = (IOrganizationService)serviceProxy;
               mySecurityRole.getSecurityRoleGuidBySecurityRoleName(webservice);

               }*/
        }
Exemplo n.º 2
0
        //public void AssignSecurityRole(Guid prmUserId, Guid prmSecurityRoleId, IOrganizationService prmCrmWebService)
        public void AssignSecurityRole(SecurityRoleBase mySecurityRoleBase, IOrganizationService prmCrmWebService)
        {
            // Create new Associate Request object for creating a N:N link between User and Security
            AssociateRequest wod_AssosiateRequest = new AssociateRequest();

            // Create related entity reference object for associating relationship
            // In our case we will pass (SystemUser) record reference

            wod_AssosiateRequest.RelatedEntities = new EntityReferenceCollection();
            wod_AssosiateRequest.RelatedEntities.Add(new EntityReference("systemuser", this.guidUserId));

            // Create new Relationship object for System User & Security Role entity schema and assigning it
            // to request relationship property

            wod_AssosiateRequest.Relationship = new Relationship("systemuserroles_association");

            // Create target entity reference object for associating relationship
            mySecurityRoleBase.getSecurityRoleGuidBySecurityRoleName(prmCrmWebService);
            wod_AssosiateRequest.Target = new EntityReference("role", mySecurityRoleBase.guidSecurityRoleId);

            // Passing AssosiateRequest object to Crm Service Execute method for assigning Security Role to User
            prmCrmWebService.Execute(wod_AssosiateRequest);
        }