msgraph-sdk-python-core icon indicating copy to clipboard operation
msgraph-sdk-python-core copied to clipboard

Support for automatic paging

Open jameskirsop opened this issue 4 years ago • 0 comments

It would be helpful for this implementation to support the automation of returning the results from all the available pages in a request. I see this as a boolean flag which specifies if you want to get all the results in a single call, or handle this yourself (with the default being the latter - for performance reasons). There are instances where I need to grab all the objects in a list of results, not just the first x results.

I could write this myself for each request I make, or subclass the client, but having this built in by a (named) argument passed to the .get() function would be preferable to keep to DRY principals.

Implementation wise it would require a loop checking for the @odata.nextLink key in the returned JSON dictionary for each fetch, and returning all the results when this key is no longer present in the response.

jameskirsop avatar Sep 01 '21 03:09 jameskirsop