Dynamics 365 paging with fetchxml
Dynamics 365 web service has limitation to return 5000 records in a single web service call. Many a times we get the requirement to fetch more than 5000 records to meet the business requirement. Microsoft has provided the concept of paging where we can get the data returned in multiple pages. We can make use of paging and page cookie to get more then 5000 record. Below code snippet will help you achieve this. public List<Entity> GetRecordsByFetchXml(IOrganizationService service, String fetchXML) { List<Entity> objList = new List<Entity>(); try { // Define the fetch attributes. // Set the number of records per page to retrieve. int fetchCount = 500; // Initialize the page number. int pageNumber = 1; // Specify the current paging cookie. For retrieving the first page, // pagingCookie should be null.