Export (0) Print
Expand All
Expand Minimize

Retrieve Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online and offline

Retrieves a business entity instance with the specified ID.

The relevant classes are specified in the following table.

TypeClass
RequestRetrieveRequest
ResponseRetrieveResponse
TargetTargetRetrieve
EntitySee the following table.

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

EntityTarget class
accountTargetRetrieveAccount
activitymimeattachmentTargetRetrieveActivityMimeAttachment
activitypointerTargetRetrieveActivityPointer
annotationTargetRetrieveAnnotation
annualfiscalcalendarTargetRetrieveAnnualFiscalCalendar
appointmentTargetRetrieveAppointment
bulkdeleteoperationTargetRetrieveBulkDeleteOperation
bulkdeletefailureTargetRetrieveBulkDeleteFailure
bulkoperationlogTargetRetrieveBulkOperationLog
businessunitTargetRetrieveBusinessUnit
businessunitnewsarticleTargetRetrieveBusinessUnitNewsArticle
calendarTargetRetrieveCalendar
campaignTargetRetrieveCampaign
campaignactivityTargetRetrieveCampaignActivity
campaignresponseTargetRetrieveCampaignResponse
competitorTargetRetrieveCompetitor
constraintbasedgroupTargetRetrieveConstraintBasedGroup
contactTargetRetrieveContact
contractTargetRetrieveContract
contractdetailTargetRetrieveContractDetail
contracttemplateTargetRetrieveContractTemplate
customeraddressTargetRetrieveCustomerAddress
customeropportunityroleTargetRetrieveCustomerOpportunityRole
customerrelationshipTargetRetrieveCustomerRelationship
discountTargetRetrieveDiscount
discounttypeTargetRetrieveDiscountType
displaystringTargetRetrieveDisplayString
duplicaterecordTargetRetrieveDuplicateRecord
duplicateruleTargetRetrieveDuplicateRule
duplicateruleconditionTargetRetrieveDuplicateRuleCondition
DynamicEntityTargetRetrieveDynamic
emailTargetRetrieveEmail
equipmentTargetRetrieveEquipment
faxTargetRetrieveFax
fixedmonthlyfiscalcalendarTargetRetrieveFixedMonthlyFiscalCalendar
importTargetRetrieveImport
importfileTargetRetrieveImportFile
importlogTargetRetrieveImportLog
importmapTargetRetrieveImportMap
incidentTargetRetrieveIncident
incidentresolutionTargetRetrieveIncidentResolution
invoiceTargetRetrieveInvoice
invoicedetailTargetRetrieveInvoiceDetail
kbarticleTargetRetrieveKbArticle
kbarticlecommentTargetRetrieveKbArticleComment
kbarticletemplateTargetRetrieveKbArticleTemplate
leadTargetRetrieveLead
letterTargetRetrieveLetter
listTargetRetrieveList
monthlyfiscalcalendarTargetRetrieveMonthlyFiscalCalendar
opportunityTargetRetrieveOpportunity
opportunitycloseTargetRetrieveOpportunityClose
opportunityproductTargetRetrieveOpportunityProduct
ordercloseTargetRetrieveOrderClose
organizationTargetRetrieveOrganization
phonecallTargetRetrievePhoneCall
plugintypeTargetRetrievePluginType
pricelevelTargetRetrievePriceLevel
privilegeTargetRetrievePrivilege
productTargetRetrieveProduct
productpricelevelTargetRetrieveProductPriceLevel
quarterlyfiscalcalendarTargetRetrieveQuarterlyFiscalCalendar
queueTargetRetrieveQueue
queueitemTargetRetrieveQueueItem
quoteTargetRetrieveQuote
quotecloseTargetRetrieveQuoteClose
quotedetailTargetRetrieveQuoteDetail
relationshiproleTargetRetrieveRelationshipRole
relationshiprolemapTargetRetrieveRelationshipRoleMap
resourceTargetRetrieveResource
resourcegroupTargetRetrieveResourcesGroup
resourcespecTargetRetrieveResourcesSpec
roleTargetRetrieveRole
salesliteratureTargetRetrieveSalesLiterature
salesliteratureitemTargetRetrieveSalesLiteratureItem
salesorderTargetRetrieveSalesOrder
salesorderdetailTargetRetrieveSalesOrderDetail
savedqueryTargetRetrieveSavedQuery
semiannualfiscalcalendarTargetRetrieveSemiAnnualFiscalCalendar
serviceTargetRetrieveService
serviceappointmentTargetRetrieveServiceAppointment
siteTargetRetrieveSite
subjectTargetRetrieveSubject
systemuserTargetRetrieveSystemUser
taskTargetRetrieveTask
teamTargetRetrieveTeam
templateTargetRetrieveTemplate
territoryTargetRetrieveTerritory
uomTargetRetrieveUoM
uomscheduleTargetRetrieveUoM
userqueryTargetRetrieveUserQuery
wfprocessTargetRetrieveWFProcess (Deprecated)
wfprocessinstanceTargetRetrieveWFProcessInstance (Deprecated)
Custom entityTargetRetrieveX where X is the name of the custom entity

Remarks

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

If the columnset includes attributes that are not valid for retrieve, they will be ignored.

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

For better performance, use the Retrieve method instead of using this message.

Example

The following code example shows how to use the Retrieve 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 column set object that indicates the fields to be retrieved.
ColumnSet cols = new ColumnSet();

// Set the properties of the column set.
cols.Attributes = new string [] {"name"};

// Create the target object for the request.
TargetRetrieveAccount target = new TargetRetrieveAccount();

// Set the properties of the target object.
// EntityId is the GUID of the record being retrieved.
target.EntityId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

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

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

// Execute the request.
RetrieveResponse retrieved = (RetrieveResponse)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 column set object that indicates the fields to be retrieved.
Dim cols As New ColumnSet()

' Set the properties of the column set.
cols.Attributes = New String() {"name"}

' Create the target object for the request.
Dim target As New TargetRetrieveAccount()

' Set the properties of the target object.
' EntityId is the GUID of the record being retrieved.
target.EntityId = New Guid("2B951FBC-1C56-4430-B23B-20A1349068F3")

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

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

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

See Also

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft