Export (0) Print
Expand All
Expand Minimize

RetrieveSharedPrincipalsAndAccess Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online and offline

Retrieves all of the security principals (users or teams) that have access to and their access rights for the specified entity instance.

The relevant classes are specified in the following table.

TypeClass
RequestRetrieveSharedPrincipalsAndAccessRequest
ResponseRetrieveSharedPrincipalsAndAccessResponse
TargetTargetOwned Class
EntitySee the following table.

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

EntityTarget class
accountTargetOwnedAccount
annotationTargetOwnedAnnotation
appointmentTargetOwnedAppointment
campaignTargetOwnedCampaign
campaignactivityTargetOwnedCampaignActivity
campaignresponseTargetOwnedCampaignResponse
contactTargetOwnedContact
contractTargetOwnedContract
customeropportunityroleTargetOwnedCustomerOpportunityRole
customerrelationshipTargetOwnedCustomerRelationship
emailTargetOwnedEmail
faxTargetOwnedFax
incidentTargetOwnedIncident
incidentresolutionTargetOwnedIncidentResolution
invoiceTargetOwnedInvoice
leadTargetOwnedLead
letterTargetOwnedLetter
listTargetOwnedList
opportunityTargetOwnedOpportunity
opportunitycloseTargetOwnedOpportunityClose
ordercloseTargetOwnedOrderClose
phonecallTargetOwnedPhoneCall
quoteTargetOwnedQuote
quotecloseTargetOwnedQuoteClose
salesorderTargetOwnedSalesOrder
serviceappointmentTargetOwnedServiceAppointment
templateTargetOwnedTemplate
userqueryTargetOwnedUserQuery
User owned custom business entitiesTargetOwnedX where X is the name of the entity
Dynamic entitiesTargetOwnedDynamic

Remarks

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

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

Example

The following code example shows how to use the RetrieveSharedPrincipalsAndAccess 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 target object for the request.
TargetOwnedAccount target = new TargetOwnedAccount();

// Set the properties of the target object.
// EntityId is the object that access is being checked to.
target.EntityId = new Guid("6A92D3AE-A9C9-4E44-9FA6-F3D5643753C1");

// Create the request object.
RetrieveSharedPrincipalsAndAccessRequest retrieve = 
    new RetrieveSharedPrincipalsAndAccessRequest();

// Set the properties of the request object.
retrieve.Target = target;

// Execute the request.
RetrieveSharedPrincipalsAndAccessResponse retrieved = 
    (RetrieveSharedPrincipalsAndAccessResponse)service.Execute(retrieve);

[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 target object for the request.
Dim target As New TargetOwnedAccount()

' Set the properties of the target object.
' EntityId is the object that access is being checked to.
target.EntityId = New Guid("6A92D3AE-A9C9-4E44-9FA6-F3D5643753C1")

' Create the request object.
Dim retrieve As New RetrieveSharedPrincipalsAndAccessRequest()

' Set the properties of the request object.
retrieve.Target = target

' Execute the request.
Dim retrieved As RetrieveSharedPrincipalsAndAccessResponse = CType(service.Execute(retrieve), RetrieveSharedPrincipalsAndAccessResponse)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft