Partager via


RetrieveRequest Class

Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online

Contains the data that is needed to retrieve a record.

Namespace: Microsoft.Xrm.Sdk.Messages
Assembly: Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Syntax

'Declaration
<DataContractAttribute(Namespace:="https://schemas.microsoft.com/xrm/2011/Contracts")> _
Public NotInheritable Class RetrieveRequest
    Inherits OrganizationRequest
[DataContractAttribute(Namespace="https://schemas.microsoft.com/xrm/2011/Contracts")] 
public sealed class RetrieveRequest : OrganizationRequest

Example

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.

//Create the request
RetrieveRequest request = new RetrieveRequest();
request.ColumnSet = new ColumnSet(new string[] { "birthdate" });
request.Target = new EntityReference(EntityName.Contact, contactId);

//Retrieve the entity to determine what the birthdate is set at
Entity entity = (Entity)((RetrieveResponse)service.Execute(request)).Entity;

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 the Execute method, which returns an instance of the RetrieveResponse class.

Privileges and Access Rights

To perform this action, the caller must have access rights on the specified records in the Target property. For a list of the required privileges, see Retrieve Privileges.

Notes for Callers

The returned record contains the values for the properties that are specified in the ColumnSet property for which the calling user has access rights. No other property values are returned. For more information about field security, see How Field Security Can Be Used to Control Access to Field Values In CRM.

Supported Entities

You can use this method to retrieve any records for entities (includes custom entities) that support the Retrieve message.

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

Both

activitymimeattachment

Both

activitypointer

Both

annotation

Both

annualfiscalcalendar

Both

appointment

Both

asyncoperation

Both

attributemap

Server

audit

Server

bulkdeletefailure

Both

bulkdeleteoperation

Both

bulkoperation

Both

bulkoperationlog

Both

businessunit

Both

businessunitnewsarticle

Both

calendar

Both

campaign

Both

campaignactivity

Both

campaignresponse

Both

columnmapping

Both

competitor

Both

connection

Both

connectionrole

Both

connectionroleobjecttypecode

Both

constraintbasedgroup

Both

contact

Both

contract

Both

contractdetail

Both

contracttemplate

Both

customeraddress

Both

customeropportunityrole

Both

customerrelationship

Both

dependency

Server

discount

Both

discounttype

Both

displaystring

Both

duplicaterecord

Server

duplicaterule

Server

duplicaterulecondition

Server

email

Both

entitymap

Server

emailserverprofile

Server

equipment

Both

fax

Both

fieldpermission

Server

fieldsecurityprofile

Server

fixedmonthlyfiscalcalendar

Both

goal

Both

goalrollupquery

Both

import

Both

importentitymapping

Both

importfile

Both

importjob

Both

importlog

Both

importmap

Both

incident

Both

incidentresolution

Both

invaliddependency

Server

invoice

Both

invoicedetail

Both

isvconfig

Server

kbarticle

Both

kbarticlecomment

Both

kbarticletemplate

Both

lead

Both

leadaddress

Both

letter

Both

list

Both

lookupmapping

Both

mailbox

Both

mailmergetemplate

Both

metric

Both

monthlyfiscalcalendar

Both

msdyn_postalbum

Server

msdyn_postconfig

Server

msdyn_postruleconfig

Server

opportunity

Both

opportunityclose

Both

opportunityproduct

Both

orderclose

Both

organization

Both

organizationui

Both

ownermapping

Both

phonecall

Both

picklistmapping

Both

pluginassembly

Both

plugintype

Both

plugintypestatistic

Server

post

Server

postcomment

Server

postfollow

Server

postlike

Server

pricelevel

Both

principalobjectattributeaccess

Both

privilege

Both

processsession

Both

product

Both

productpricelevel

Both

publisher

Both

publisheraddress

Server

quarterlyfiscalcalendar

Both

queue

Both

queueitem

Both

quote

Both

quoteclose

Both

quotedetail

Both

recurrencerule

Both

recurringappointmentmaster

Both

relationshiprole

Both

relationshiprolemap

Both

report

Both

reportcategory

Both

reportentity

Both

reportlink

Both

reportvisibility

Both

resource

Both

resourcegroup

Both

resourcespec

Both

role

Both

rollupfield

Both

salesliterature

Both

salesliteratureitem

Both

salesorder

Both

salesorderdetail

Both

savedquery

Both

savedqueryvisualization

Both

sdkmessage

Both

sdkmessagefilter

Both

sdkmessagepair

Both

sdkmessageprocessingstep

Both

sdkmessageprocessingstepimage

Both

sdkmessageprocessingstepsecureconfig

Server

sdkmessagerequest

Both

sdkmessagerequestfield

Both

sdkmessageresponse

Both

sdkmessageresponsefield

Both

semiannualfiscalcalendar

Both

service

Both

serviceappointment

Both

serviceendpoint

Server

sharepointdocumentlocation

Server

sharepointsite

Server

site

Both

sitemap

Both

solution

Both

solutioncomponent

Both

subject

Both

systemform

Both

systemuser

Both

task

Both

team

Both

template

Both

territory

Both

timezonedefinition

Both

timezonelocalizedname

Both

timezonerule

Both

tracelog

Both

transactioncurrency

Both

transformationmapping

Both

transformationparametermapping

Both

uom

Both

uomschedule

Both

userentityinstancedata

Both

userentityuisettings

Both

userform

Both

userquery

Both

userqueryvisualization

Both

usersettings

Both

webresource

Both

workflow

Server

workflowdependency

Server

workflowlog

Server

Inheritance Hierarchy

System.Object
   Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Xrm.Sdk.Messages.RetrieveRequest

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.

Platforms

Development Platforms

Windows Server 2008, Windows Server 2012, Windows 7 (All Versions), Windows 8 (All Versions)

Target Platforms

Windows Server 2008, ,Windows Server 2012, ,Windows 7 (All Versions),

Change History

See Also

Reference

RetrieveRequest Members
Microsoft.Xrm.Sdk.Messages Namespace
RetrieveResponse

Other Resources

Build Queries with QueryExpression
Build Queries with FetchXML
Sample: Update Next Birthday Using a Custom Workflow Activity
Retrieve Privileges

Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.