Share via


ModifyAccessRequest Class

Definition

Contains the data that is needed to replace the access rights on the target record for the specified security principal (user, team, or organization).

public ref class ModifyAccessRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class ModifyAccessRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type ModifyAccessRequest = class
    inherit OrganizationRequest
Public NotInheritable Class ModifyAccessRequest
Inherits OrganizationRequest
Inheritance
ModifyAccessRequest
Attributes

Examples

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 instance.

/// <summary>
/// Modifies the access to a shared record.
/// </summary>
/// <param name="service">Authenticated client implementing the IOrganizationService interface</param>
/// <param name="principal">The user, team, or organization to modify rights to the shared.</param>
/// <param name="access">The access rights to modify</param>
/// <param name="record">The shared record</param>
static void ModifyShare(
   IOrganizationService service,
   EntityReference principal,
   AccessRights access,
   EntityReference record)
{
   PrincipalAccess principalAccess = new()
   {
         AccessMask = access,
         Principal = principal
   };

   ModifyAccessRequest request = new()
   {

         PrincipalAccess = principalAccess,
         Target = record
   };

   service.Execute(request);
}

Remarks

Learn more about Sharing records.

For the Web API use the ModifyAccess action.

Usage

Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of the ModifyAccessResponse class.

Privileges and Access Rights

To perform this action, the caller must have privileges for the table and access rights on the record that is specified in the Target property.

Supported Tables

See Message support for tables for an example query you can use to get the list of tables you can use with the ModifyAccess message.

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 tables or share rights to the records, the child records are not shared. As a result, the owner of the record, or a user who shares the record that has share rights, automatically has share rights to all child records of the record. In this case, only the lack of privileges to a particular table prevents the child records from being shared.

For a description of how actions on a parent record can affect related records, see Configure table relationship cascading behavior.

Constructors

ModifyAccessRequest()

Initializes a new instance of the ModifyAccessRequest class.

Properties

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
PrincipalAccess

Gets or sets the team or user whose access to the specified record is modified. Required.

RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
Target

Gets or sets the entity that is the target of the request to modify access. Required.

Applies to

See also