Export (0) Print
Expand All
Expand Minimize

RevokeAccess Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online only

Revokes access rights to the entity instance for the specified security principal (user or team).

The relevant classes are specified in the following table.

TypeClass
RequestRevokeccessRequest
ResponseRevokeAccessResponse
TargetTargetOwned Class
EntitySee below.

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

EntityTarget Class
accountTargetOwnedAccount
annotationTargetOwnedAnnotation
appointmentTargetOwnedAppointment
asyncoperationTargetOwnedAsyncOperation
campaignTargetOwnedCampaign
campaignactivityTargetOwnedCampaignActivity
campaignresponseTargetOwnedCampaignResponse
contactTargetOwnedContact
contractTargetOwnedContract
customeropportunityroleTargetOwnedCustomerOpportunityRole
customerrelationshipTargetOwnedCustomerRelationship
duplicateruleTargetOwnedDuplicateRule
DynamicEntityTargetOwnedDynamic
emailTargetOwnedEmail
faxTargetOwnedFax
incidentTargetOwnedIncident
invoiceTargetOwnedInvoice
leadTargetOwnedLead
letterTargetOwnedLetter
listTargetOwnedList
mailmergetemplateTargetOwnedMailMergeTemplate
opportunityTargetOwnedOpportunity
opportunitycloseTargetOwnedOpportunityClose
ordercloseTargetOwnedOrderClose
phonecallTargetOwnedPhoneCall
quoteTargetOwnedQuote
quotecloseTargetOwnedQuoteClose
reportTargetOwnedReport
salesorderTargetOwnedSalesOrder
serviceappointmentTargetOwnedServiceAppointment
taskTargetOwnedTask
templateTargetOwnedTemplate
User-owned custom entityTargetOwnedX where X is the name of the custom entity
userqueryTargetOwnedUserQuery
workflowTargetOwnedWorkflow

Remarks

To use this message, pass an instance of the RevokeccessRequest class as the request parameter in the Execute method.

This method also applies to all child instances of the target instance. For all child instances, if the caller does not have share privileges for those entity types or share rights to the instances, access to the child instances is not revoked. As a result, the owner of the instance or a user who shares the instance with share rights automatically has share rights to all child instances of the target instance. In this case, only the lack of privileges to a particular entity type prevents access to the child instances 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#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the SecurityPrincipal.
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]
' Set up the CRM service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle"
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx"
service.CrmAuthenticationTokenValue = token
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the SecurityPrincipal.
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)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft