Skip to content

Sample code to retrieve more than 5000 records using FetchXML in CRM – Nishant Rana’s Weblog

Hi,

Sharing a sample code to retrieve more than 5000 records using the Fetch XML.

Version 1 :


private List<Entity> GetTotalRecordsfromFetch(string fetchXML, IOrganizationService orgService)
{
List<Entity> lstEntity = new List<Entity>();

int fetchCount = 5000;
int pageNumber = 1;
string pagingCookie = null;

while (true)
{
// Build fetchXml string with the placeholders.
string xml = this.CreateXml(fetchXML, pagingCookie, pageNumber, fetchCount);
RetrieveMultipleRequest fetchRequest = new...

Full Article

Sample code to retrieve more than 5000 records using FetchXML in CRM – Nishant Rana’s Weblog

Blog Syndicated with Nishant Rana’s Permission

Leave a Reply