I am using ODATA Web API and it return only 5000 records using below command. How to get all records from that entity ?
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "api/data/v8.2/products" + queryOptions);
response = await httpClient.SendAsync(request );
myresult = JsonConvert.DeserializeObject<JObject>(response.Content.ReadAsStringAsync().Result);
myresult["value"].Count()
*This post is locked for comments
Thank you Nilanka for response.
I am not using XML but plan API calls.
Here with code I am using and look like using page2Uri validating for remaining pages...
So far it worked for one entity and will test for other entities.
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "api/data/v8.2/products" + queryOptions2);
response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
if (response.StatusCode == HttpStatusCode.OK) {
contact1 = JsonConvert.DeserializeObject<JObject>(response.Content.ReadAsStringAsync().Result);
console.WriteLine(contact1);
page2Uri = null;
if ( contact1["@odata.nextLink"] != null )
page2Uri = contact1["@odata.nextLink"].ToString(); //This URI is already encoded.
while (page2Uri != null)
{
request = new HttpRequestMessage(HttpMethod.Get, page2Uri);
response = await httpClient.SendAsync(request);
if (response.StatusCode == HttpStatusCode.OK) //200 {
contact1 = JsonConvert.DeserializeObject<JObject>(response.Content.ReadAsStringAsync().Result);
console.WriteLine(contact1);
if (contact1["@odata.nextLink"] == null)
page2Uri = null;
else
page2Uri = contact1["@odata.nextLink"].ToString(); //This URI is already encoded.
}
else
page2Uri = null;
} // end while
Console.WriteLine("Done with Web API Call '{0}'", DateTime.Now.ToString("h:mm:ss tt"));
} // end if
Hi Sanjay,
Can you please look into the below URLs.
https://softchief.com/2016/02/20/retrieve-more-than-5000-records-in-dynamics-crm/
https://nishantrana.me/2016/02/11/get-total-count-of-records-in-crm-more-than-5000/
Thanks
Nilanka Sekhar Paul
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156