sharing
// Create the request object and set the target and principal access
GrantAccessRequest grantRequest = new GrantAccessRequest()
{
Target = new EntityReference(Account.EntityLogicalName, accountId),
PrincipalAccess = new PrincipalAccess()
{
Principal = new EntityReference(SystemUser.EntityLogicalName, userId),
AccessMask = actionRights
}
};
// Execute the request.
GrantAccessResponse granted = (GrantAccessResponse)service.Execute(grantRequest);
Unsharing
// Create the request object and set the target and revokee.
RevokeAccessRequest revokeRequest = new RevokeAccessRequest()
{
Target = new EntityReference(Account.EntityLogicalName, accountId),
Revokee = new EntityReference(SystemUser.EntityLogicalName, accountuserId)
};
// Execute the request.
RevokeAccessResponse revoked = (RevokeAccessResponse)service.Execute(revokeRequest);
No comments:
Post a Comment