casolorz
casolorz

Reputation: 9554

Is there a way to list all fields for a file on the Google Drive API?

I have a simple issue. When I request root as parent or sharedWithMe = true the result I get has less folders than when I request root as parent and sharedWithMe = true separately. I have yet to find the difference between the folders that show up on the single query but fail to show up on the combined query.

My hope is that if I query all the fields then maybe I will be able to tell the difference. Is there a way to do that? or is there maybe a playground for the Google Drive API where I can test different queries?

This is the code that returns less folders than it should:

val response =
 gDriveClient.files()
 .list()
 .setSpaces("drive")
 .setCorpora("user")
 .setFields("files(id, name, size, modifiedTime, mimeType, parents, quotaBytesUsed),nextPageToken")
 .setQ("('root' in parents or sharedWithMe = true) and trashed = false")
 .setSupportsAllDrivers(true)

And if I run .setQ("('root' in parents) and trashed = false") and .setQ("(sharedWithMe = true) and trashed = false") then I get more results than the code above it. Some of the shared folders are the ones that I'm missing.

Thanks.

EDIT: Just want to clarify, the correct answer below is * to get all field. The answer to my actual issue, not getting all items, is that I am not setting pageSize and it is limited to 100 by default.

Upvotes: 1

Views: 1887

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117016

To return all the fields set fields equal to *

.setFields("*")

As for your issue it sounds like a bug to me you might want to consider submitting a report Sounds like a bug i would submit it to the issue forum

Upvotes: 1

Related Questions