Security Roles are associated with Users via N:N relationship (relationship name: systemuserroles_association). So now in CRM 2011 we can use DisassociateRequest to remove programmatically user assigned security roles .
[C# Code]:
The c # code below can be used in to remove the User assigned Security Role. public void RemoveUserSecurityRole(Guid prmUserId, Guid prmSecurityRoleId, IOrganizationService prmCrmWebService) |
{ |
// Create new Disassociate Request object for creating a N:N link between User and Security |
DisassociateRequest wod_DisassociateRequest = new DisassociateRequest (); |
// Create related entity reference object for associating relationship |
// we will pass (SystemUser) record reference of user for which the role is required to be removed |
wod_DisassociateRequest.RelatedEntities = new EntityReferenceCollection(); |
wod_DisassociateRequest.RelatedEntities.Add(new EntityReference("systemuser", prmUserId)); |
// Create new Relationship object for System User & Security Role entity schema and assigning it |
// to request relationship property |
wod_DisassociateRequest.Relationship = new Relationship("systemuserroles_association"); |
// Create target entity reference object for associating relationship |
wod_DisassociateRequest.Target = new EntityReference("role", prmSecurityRoleId); |
// Passing DisassociateRequest object to Crm Service Execute method for removing Security Role to User |
prmCrmWebService.Execute(wod_DisassociateRequest); |
} |
air max 97
ReplyDeletegolden goose
kyrie 4
adidas stan smith
jordan shoes
balenciaga sneakers
vans
fila shoes
russell westbrook shoes
hogan outlet online
coach bags sale
xiaofang20191211
navigate to this site more helpful hints check out the post right here have a peek at this website my sources Recommended Reading
ReplyDeletenavigate to this web-site look at here special info check that hop over to this site find here
ReplyDeletereplica bags in delhi go now v0j45i8z87 replica bags lv this website e1o66r4f37 replica bags replica bags online pakistan replica bags south africa hermes replica handbags e6y86q4a21 replica bags australia
ReplyDeletesteroid satın al
ReplyDeleteheets
6WAV
HOT FUNE
ReplyDeleteIn this example, replace "entity_name" with the logical name of the entity you're working with, and "record_id" with the Guid of the record you want to remove. Ootdtak Kot Pernah Please ensure that you have the necessary permissions to perform this action.
ReplyDeleteUseful code
ReplyDelete