RevokeAccess Message

banner art

Revokes access rights to the specified entity instance for the specified security principal.

The relevant classes are specified in the following table.

Type Class
Request RevokeccessRequest
Response RevokeAccessResponse
Target TargetOwned Class
Entity See below.

The following table shows the entities and target classes for this message.

Entity Target Class
account TargetOwnedAccount
annotation TargetOwnedAnnotation
appointment TargetOwnedAppointment
campaign TargetOwnedCampaign
contact TargetOwnedContact
contract TargetOwnedContract
Dynamic entity TargetOwnedDynamic
incident TargetOwnedIncident
invoice TargetOwnedInvoice
lead TargetOwnedLead
list TargetOwnedList
opportunity TargetOwnedOpportunity
quote TargetOwnedQuote
salesorder TargetOwnedSalesOrder
serviceappointment TargetOwnedServiceAppointment
User owned custom entity TargetOwnedX where X is the name of the entity
userquery TargetOwnedUserQuery

Remarks

This method also applies to all child objects of the specified entity instance. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the specified entity instance. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

For a description of how actions on a parent instance affect child instances, see Cascading Rules.

To perform this action, the caller must have access rights on the entity instance specified in the request class. For a list of required privileges, see RevokeAccess Privileges.

Example

The following code example shows how to use the RevokeAccess message.

[C#]
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the SecurityPrincipal object.
SecurityPrincipal principal = new SecurityPrincipal();

principal.Type = SecurityPrincipalType.User;
// PrincipalId is the GUID of the user whose access is being revoked.
principal.PrincipalId = new Guid("7B222F98-F48A-4AED-9D09-77A19CB6EE82");

// Create the target for the request.
TargetOwnedAccount target = new TargetOwnedAccount();

// EntityId is the GUID of the account to which 
// access is being revoked.
target.EntityId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

// Create the request object.
RevokeAccessRequest revoke = new RevokeAccessRequest();

// Set the properties of the request object.
revoke.Revokee = principal;
revoke.Target = target;

// Execute the request.
RevokeAccessResponse revoked = (RevokeAccessResponse)service.Execute(revoke);

[Visual Basic .NET]
' Standard CRM Service Setup
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the SecurityPrincipal object.
Dim principal As New SecurityPrincipal()

principal.Type = SecurityPrincipalType.User
' PrincipalId is the GUID of the user whose access is being revoked.
principal.PrincipalId = new Guid("7B222F98-F48A-4AED-9D09-77A19CB6EE82");

' Create the target for the request.
Dim target As New TargetOwnedAccount()

' EntityId is the GUID of the account to which 
' access is being revoked.
target.EntityId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

' Create the request object.
Dim revoke As New RevokeAccessRequest()

'Set the properties of the request object.
revoke.Revokee = principal
revoke.Target = target

' Execute the request.
Dim revoked As RevokeAccessResponse = CType(service.Execute(revoke), RevokeAccessResponse)

Related Topics

CrmService Messages

© 2007 Microsoft Corporation. All rights reserved.