davidyack / Xrm.Tools.CRMWebAPI

This is an API helper for working with the Common Data Service (CDS) Web API
MIT License
143 stars 73 forks source link

Retrieve more than 5K records from Dynamics 365/CRM #83

Open joseRdzP opened 5 years ago

joseRdzP commented 5 years ago

Hi,

I'm trying to figure out how to retrieve more that 5k records from Dynamics 365/CRM, looks like the GetList method has a variable named "nextLink" but I can't access it from its properties. Is there any way to retrieve more than 5000 records from CRM? Is there an example to use the paging on this API? Thanks!

joseRdzP commented 5 years ago

@davidyack

davidyack commented 5 years ago

GetList follows the next links and will return you the entire set of data that matches your criteria

joseRdzP commented 5 years ago

But for example, if I try to retrieve all the records from a CRM entity without any filter on the query, by using FetchXml it gets only 5000 records, how can I access the nextLink property or how can I get the remaining records?

joseRdzP commented 5 years ago

image

davidyack commented 5 years ago

Ah yes, Fetchxml with Get does not page today that is high on the list to add - look at #49 as it has some example code that might help you in the mean time.

joseRdzP commented 5 years ago

@davidyack I've implemented my own code in my Azure Function based on code from the "GetList" method and looks like it's working as expected, however I'll do more testing on that. Thank you very much for your suggestion! Do you have an ETA for the date of the new release of the API? Will the new version contain the fix to retrieve more than 5000 records? Thank you!

davidyack commented 4 years ago

@joseRdzP I don't have an ETA depends on when anyone has free time to look at it, if you have a modified version of GetList you'd like to post here that has it working might speed up things :)

mohsinonxrm commented 4 years ago

@joseRdzP , I'll be opening a pull request in a couple of days (already coded, going to test a bit more) and submitting the changes for @davidyack to review and merge.

priyanksster commented 2 years ago

@mohsinonxrm Thanks for updating the code but I am getting the Malformed XML in the paging cookie error. I have created an issue at https://github.com/davidyack/Xrm.Tools.CRMWebAPI/issues/117 Any idea, what could be wrong? There are more than 5K records.

mohsinonxrm commented 2 years ago

@priyanksster , I haven't looked at this in a while. What's your use case? Can you post a gist of your code? Is it as easy as pulling more than 5k records of say OOB account entity and I should be able to reproduce it?

Also, just FYI, MS has release their new DV Client that works with .NET Framework and dotnet core/dotnet 6, so if you want to transition to that, that's an option.