Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
![]() |
Retrieves a business entity with the specified ID.
The relevant classes are specified in the following table.
Type | Class |
Request | RetrieveRequest |
Response | RetrieveResponse |
Target | TargetRetrieve |
Entity | See below. |
The following table shows the entities and target classes for this message.
Remarks
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.
Example
The following code example shows how to use the Retrieve message.
[C#]
// Set up the CRM Service.
CrmService service = new CrmService();
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 service As New CrmService()
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)
Related Topics