You can only get 5,000 records at a time using an XML file.
To get more entries, you should use a paging cookie, see here:
Example: use FetchXML with a paging file
Corresponding code bits:
The main loop has been changed since the sample does not seem to update the swap cookie:
while (true) { // Build fetchXml string with the placeholders. string xml = CreateXml(fetchXml, pagingCookie, pageNumber, fetchCount); FetchExpression expression = new FetchExpression(xml); var results = proxy.RetrieveMultiple(expression); // * Build up results here * // Check for morerecords, if it returns 1. if (results.MoreRecords) { // Increment the page number to retrieve the next page. pageNumber++; pagingCookie = results.PagingCookie; } else { // If no more records in the result nodes, exit the loop. break; } }
I personally prefer to use LINQ rather than FetchXML, but it is worth noting that Lasse W. Carlsen said if you present this information to the user, you probably want to do some kind of paging (either in FetchXML or in LINQ)
source share