添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
HttpResponseMessage response = httpClient.GetAsync(ConfigurationManager.AppSettings["ServerAddress"] + "api/data/v8.0/" + uri, HttpCompletionOption.ResponseHeadersRead).Result;
            JObject responseObject = new JObject();
            if (response.IsSuccessStatusCode)
                responseObject = JObject.Parse(response.Content.ReadAsStringAsync().Result);
 dynamic systemUserObject = JsonConvert.DeserializeObject(jRetrieveResponse.ToString());
                foreach (var data in systemUserObject.value)
               var contactType= data.contacttype.Value;

Iam using Rest API to connect CRM and while converting Can we convert Json object to entity Collection ? or is there any easy way to convert response data to entity collection ? 

Here main problem is assining values to properties and need to check field existance before assining value to property like below ? Any Ideas?

  foreach (var data in systemUserObject.value)

              var contactType= data.contacttype.Value;

krishna prasad

Have a look Here.

https://yanivrdt.wordpress.com/2015/09/27/crm-web-api-preview-generate-strongly-typed-objects-from-metadata-document/

if (retrieveResponse.IsSuccessStatusCode)

                   var Content = await retrieveResponse.Content.ReadAsStringAsync();

                   ODataResponse<T>  odataresponse = JsonConvert.DeserializeObject<ODataResponse<T>>(Content);

public class ODataResponse<T>

       public T[] Value { get; set; }

Kind regards,

CRM Developer

Subscribe to

Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.