Export (0) Print
Expand All

ModifyAccess Message

CRM 1.2
banner art

Replaces the access rights on the specified entity instance for the specified security principal (user or team).

The relevant classes are specified in the following table.

Type Class
Request ModifyAccessRequest
Response ModifyAccessResponse
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 custom entity
userquery TargetOwnedUserQuery

Remarks

This action 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, the child objects are not shared. 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 the child objects from being shared.

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 ModifyAccess Privileges.

Example

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

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

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

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

// Create the PrincipalAccess object.
PrincipalAccess principalAccess = new PrincipalAccess();

// Set the properties of the PrincipalAccess object.
principalAccess.Principal = principal;
// Give the principal access to delete.
principalAccess.AccessMask = AccessRights.ReadAccess;

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

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

// Create the request object.
ModifyAccessRequest modify = new ModifyAccessRequest();

// Set the properties of the request object.
modify.PrincipalAccess = principalAccess;
modify.Target = target;

// Execute the request.
ModifyAccessResponse modified = (ModifyAccessResponse)service.Execute(modify);
[Visual Basic .NET]
' Set up the CRM Service.
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

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

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

' Create the PrincipalAccess object.
Dim principalAccess As New PrincipalAccess()

' Set the properties of the PrincipalAccess object.
principalAccess.Principal = principal
' Give the principal access to delete.
principalAccess.AccessMask = AccessRights.ReadAccess

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

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

' Create the request object.
Dim modify As New ModifyAccessRequest()

' Set the properties of the request object.
modify.PrincipalAccess = principalAccess
modify.Target = target

' Execute the request.
Dim modified As ModifyAccessResponse = CType(service.Execute(modify), ModifyAccessResponse)

Related Topics

CrmService Messages


© 2007 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft