// Retrieve Contact to a Dynamic Entity in CRM 4.0
private DynamicEntity retriveDynamic(CrmService _svc,string p_entNm, string p_entGuid)
{
// Create the retrieve target.
TargetRetrieveDynamic targetRetrieve = new TargetRetrieveDynamic();
// Set the properties of the target.
targetRetrieve.EntityName = p_entGuid;
targetRetrieve.EntityId = new Guid(p_entGuid);
// Create the request object.
RetrieveRequest retrieve = new RetrieveRequest();
// Set the properties of the request object.
retrieve.Target = targetRetrieve;
retrieve.ColumnSet = new AllColumns();
// Indicate that the BusinessEntity should be retrieved as a DynamicEntity.
retrieve.ReturnDynamicEntities = true;
// Execute the request.
RetrieveResponse retrieved = (RetrieveResponse)_svc.Execute(retrieve);
// Extract the DynamicEntity from the request.
DynamicEntity entity = (DynamicEntity)retrieved.BusinessEntity;
//// Extract the fullname from the dynamic entity
//string fullname;
//for (int i = 0; i < entity.Properties.Length; i++)
//{
// if (entity.Properties[i].Name.ToLower() == "fullname")
// {
// StringProperty property = (StringProperty)entity.Properties[i];
// fullname = property.Value;
// break;
// }
//}
return entity;
}