Search

Retrieves a business entity instance with the specified ID

Retrieves a business entity instance with the specified ID.

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.

//# The following code example shows how to use the Retrieve message.

// 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://:/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);