Reputation: 1
I reproduced my problem which happened in Javascript API using an empty google drive and the Google Drive Web APIs.
I did the following:
a.) Created 20 Files "a01_01 .. a01_20" using Files:insert
b.) Created 5 more files "test1 .. test5" using Files:insert
c.) did a Files:list query with q=title contains "a01" and set maxResults to 15 and fields to items/title,nextPageToken. Executed the Request. The result listed "a01_01 .. a01_15" correctly and got the nextPageToken because there were more items left.
d.) Copied the nextPageToken from result in c.) an put it as the pagetoken of the next query. I then removed the content of q and executed the request.
Now I expected to see "a01_16 .. a01_20" as result. But I got additionaly the other files "test1 .. test5" listed.
If there are some more files in your drive you will get them too. You can go on to use requests with nextPageToken till all files in your Google Drive are listed.
How can I execute a query where the result has more items than maxResults, whitout getting results which I have not asked for?
Upvotes: 0
Views: 507
Reputation: 42038
"I then removed the content of q"
You need to leave the query exactly the same, only updating the pageToken on each subsequent request.
You can play around with this on the Developer Site in the Files.List Try it now sample
Upvotes: 1