GrantAccessRequest Class
Contains the data that is needed to grant a security principal (user or team) access to the specified record. Namespace: Microsoft.Crm.Sdk.Messages
Assembly: Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy)
The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. For the complete sample, see the link later in this topic.
// Grant the team read/write access to the lead. var teamReference = new EntityReference(Team.EntityLogicalName, _teamId); var grantAccessRequest = new GrantAccessRequest { PrincipalAccess = new PrincipalAccess { AccessMask = AccessRights.ReadAccess | AccessRights.WriteAccess, Principal = teamReference }, Target = leadReference }; Console.WriteLine("Granting {0} to {1} ({2}) on the lead...\r\n", AccessRights.ReadAccess | AccessRights.WriteAccess, GetEntityReferenceString(teamReference), "Team"); _serviceProxy.Execute(grantAccessRequest); var systemUser2Ref = new EntityReference(SystemUser.EntityLogicalName, _systemUserIds[1]);
Message Availability
For this message to work, the caller must be connected to the server.
Usage
Pass an instance of this class to the Execute method, which returns an instance of the GrantAccessResponse class.
Privileges and Access Rights
To perform this action, the caller must have privileges on the specified entity in the Target property and access rights on the specified record in the Target property. For a list of the required privileges, see GrantAccess Privileges.
Notes for Callers
This action applies to all child records of the target record. For all child records, if the caller does not have share privileges for those entity types, or share rights to the records, the child records are not shared. 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 records of the target record. In this case, only the lack of privileges for a particular entity type prevents the child records from being shared.
For a description of how actions on a parent instance affect child records, see Cascading Behavior.
Supported Entities
The following table shows the default entities that support this message. For the listed entities, the caller must be connected to the server for this message to be available.
| Entity | Availability |
|---|---|
|
account |
Server |
|
annotation |
Server |
|
appointment |
Server |
|
campaign |
Server |
|
campaignactivity |
Server |
|
campaignresponse |
Server |
|
connection |
Server |
|
contact |
Server |
|
contract |
Server |
|
customeropportunityrole |
Server |
|
customerrelationship |
Server |
|
duplicaterule |
Server |
|
|
Server |
|
fax |
Server |
|
goal |
Server |
|
goalrollupquery |
Server |
|
import |
Server |
|
importfile |
Server |
|
importmap |
Server |
|
incident |
Server |
|
incidentresolution |
Server |
|
invoice |
Server |
|
lead |
Server |
|
letter |
Server |
|
list |
Server |
|
mailmergetemplate |
Server |
|
opportunity |
Server |
|
opportunityclose |
Server |
|
orderclose |
Server |
|
phonecall |
Server |
|
processsession |
Server |
|
queue |
Server |
|
quote |
Server |
|
quoteclose |
Server |
|
recurringappointmentmaster |
Server |
|
report |
Server |
|
salesorder |
Server |
|
serviceappointment |
Server |
|
sharepointdocumentlocation |
Server |
|
sharepointsite |
Server |
|
task |
Server |
|
template |
Server |
|
userform |
Server |
|
userquery |
Server |
|
userqueryvisualization |
Server |
|
workflow |
Server |
Development Platforms
Windows Server 2008Target Platforms
Windows Server 2008, Windows 7 (All Versions), Windows Vista (All Versions)Reference
GrantAccessRequest MembersMicrosoft.Crm.Sdk.Messages Namespace
Actions on Entity Records
GrantAccessResponse
Other Resources
How Record-Based Security Can Be Used to Control Access to Records In Microsoft Dynamics CRMSample: Share Records Using GrantAccess, ModifyAccess and RevokeAccess Messages
Send comments about this topic to Microsoft.
© 2011 Microsoft Corporation. All rights reserved.