onedrive-php-sdk icon indicating copy to clipboard operation
onedrive-php-sdk copied to clipboard

No paging handling : createCollectionRequest('GET', $endpoint)->execute();

Open landall opened this issue 5 years ago • 4 comments

createCollectionRequest->execute() is the same as createRequest->execute() without handling the paging problem. createCollectionRequest->getPage() and merge array until createCollectionRequest->isEnd() become true.

landall avatar Apr 24 '19 10:04 landall

@landall Thanks for reporting this. Let me try a few cases and see how/what can be fixed.

krizalys avatar May 01 '19 12:05 krizalys

@landall I'm working on a long-term support for pagination based on PHP iterators.

Meanwhile, I just released version 2.3.0, which added support for $options to Krizalys\Onedrive\Proxy::getChildren(). One option, top, allows you to set the maximum number of children to return. Example:

https://github.com/krizalys/onedrive-php-sdk/blob/master/src/Proxy/DriveItemProxy.php#L314-L321

The default is 200, but OneDrive seems accept much higher values (millions), though you may experience memory issues. As you can see from the example above, you may also be able to leverage the orderBy option to pull certain children closer to the top and lower the number of children required.

Give it a try and let me know if it is an acceptable workaround to your issue.

krizalys avatar Aug 18 '19 05:08 krizalys

@krizalys Any update about the pagination?

L3o-pold avatar Nov 27 '19 17:11 L3o-pold

@L3o-pold No update.

krizalys avatar Jan 13 '20 17:01 krizalys