Jaa


RetrieveSharedPrincipalsAndAccessRequest Class

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Contains the data that is needed to retrieve all security principals (users or teams) that have access to, and access rights for, the specified record.

Namespace:   Microsoft.Crm.Sdk.Messages
Assembly:  Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy.dll)

Inheritance Hierarchy

System.Object
  Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Crm.Sdk.Messages.RetrieveSharedPrincipalsAndAccessRequest

Syntax

[DataContractAttribute(Namespace = "https://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class RetrieveSharedPrincipalsAndAccessRequest : OrganizationRequest
<DataContractAttribute(Namespace := "https://schemas.microsoft.com/crm/2011/Contracts")>
Public NotInheritable Class RetrieveSharedPrincipalsAndAccessRequest
    Inherits OrganizationRequest

Constructors

Name Description
System_CAPS_pubmethod RetrieveSharedPrincipalsAndAccessRequest()

Initializes a new instance of the RetrieveSharedPrincipalsAndAccessRequest class.

Properties

Name Description
System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data. Optional.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Item[String]

Gets or sets the indexer for the Parameters collection.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestId

Gets or sets the ID of an asynchronous operation (system job). Optional. (Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Target

Gets or sets the target record for which you want to retrieve security principals (users and teams) and their access rights.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

Message Availability

This message works regardless whether the caller is connected to the server or offline. However, a few entities of this message class are exceptions to that availability. To determine which entities have a more restricted availability, see Supported Entities later in this topic.

Usage

Pass an instance of this class to theExecute method, which returns an instance of the RetrieveSharedPrincipalsAndAccessResponse class.

Privileges and Access Rights

To perform this action, the caller must have the privileges on the specified entity in the Target property and access rights on the specified record in the Target property. For a complete list of the required privileges, see the topic RetrieveSharedPrincipalsAndAccess message privileges.

Supported Entities

The following table shows the default entities that support this message. For the listed entities of this message, the Availability column shows Server if the caller must be connected to the server and shows Both if the caller can be either connected to, or disconnected from, the server.

Entity

Availability

Account

2 (Both)

Annotation

2 (Both)

Appointment

2 (Both)

Campaign

2 (Both)

CampaignActivity

2 (Both)

CampaignResponse

2 (Both)

Connection

2 (Both)

Contact

2 (Both)

Contract

2 (Both)

ConvertRule

2 (Both)

CustomerOpportunityRole

2 (Both)

CustomerRelationship

2 (Both)

DuplicateRule

2 (Both)

Email

2 (Both)

EmailServerProfile

2 (Both)

Entitlement

2 (Both)

Fax

2 (Both)

Goal

2 (Both)

GoalRollupQuery

2 (Both)

Import

2 (Both)

ImportFile

2 (Both)

ImportMap

2 (Both)

Incident

2 (Both)

IncidentResolution

2 (Both)

Invoice

2 (Both)

Lead

2 (Both)

Letter

2 (Both)

List

2 (Both)

Mailbox

2 (Both)

MailMergeTemplate

2 (Both)

msdyn_PostAlbum

2 (Both)

msdyn_wallsavedqueryusersettings

2 (Both)

Opportunity

2 (Both)

OpportunityClose

2 (Both)

OrderClose

2 (Both)

PhoneCall

2 (Both)

ProcessSession

2 (Both)

Queue

2 (Both)

Quote

2 (Both)

QuoteClose

2 (Both)

RecurringAppointmentMaster

2 (Both)

Report

2 (Both)

RoutingRule

2 (Both)

SalesOrder

2 (Both)

ServiceAppointment

2 (Both)

SharePointDocumentLocation

2 (Both)

SharePointSite

2 (Both)

SLA

2 (Both)

SLAKPIInstance

2 (Both)

SocialActivity

2 (Both)

SocialProfile

2 (Both)

Task

2 (Both)

Template

2 (Both)

UserForm

2 (Both)

UserQuery

2 (Both)

UserQueryVisualization

2 (Both)

Workflow

2 (Both)

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. For the complete sample, see the link later in this topic.


var accessRequest = new RetrieveSharedPrincipalsAndAccessRequest
{
    Target = leadReference
};

// The RetrieveSharedPrincipalsAndAccessResponse returns an entity reference
// that has a LogicalName of "user" when returning access information for a
// "team."
var accessResponse = (RetrieveSharedPrincipalsAndAccessResponse)
    _serviceProxy.Execute(accessRequest);
Console.WriteLine("The following have the specified granted access to the lead.");
foreach (var principalAccess in accessResponse.PrincipalAccesses)
{
    Console.WriteLine("\t{0}:\r\n\t\t{1}",
        GetEntityReferenceString(principalAccess.Principal),
        principalAccess.AccessMask);
}
Console.WriteLine();


Dim accessRequest = New RetrieveSharedPrincipalsAndAccessRequest With
                    {
                        .Target = leadReference
                    }

' The RetrieveSharedPrincipalsAndAccessResponse returns an entity reference
' that has a LogicalName of "user" when returning access information for a
' "team."
Dim accessResponse = CType(_serviceProxy.Execute(accessRequest), 
    RetrieveSharedPrincipalsAndAccessResponse)
Console.WriteLine("The following have the specified granted access to the lead.")
For Each principalAccess In accessResponse.PrincipalAccesses
    Console.WriteLine(vbTab &amp; "{0}:" &amp; vbCrLf &amp; vbTab &amp; vbTab &amp; "{1}",
                      GetEntityReferenceString(principalAccess.Principal),
                      principalAccess.AccessMask)
Next principalAccess
Console.WriteLine()

Thread Safety

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

RetrieveSharedPrincipalsAndAccessResponse
Microsoft.Crm.Sdk.Messages Namespace
How record-based security can be used to control access to records in Microsoft Dynamics 365
Entity ownership
Sample: Share records using GrantAccess, ModifyAccess and RevokeAccess messages

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright