Martin
Martin

Reputation: 2300

How do you get a list of files with Google Drive SDK

I have a list of file ids that I want to refresh with up-to-date metadata. I know there is a file/get method that I could call for each file, but it's obviously not the right way to deal with it if we have many files.

So I've looked for the file/list and its "q" parameter to make a search query. Unfortunately, it looks like it doesn't accept the "id IN (?, ?)" format.

So is there a clever way to do this?

Upvotes: 1

Views: 355

Answers (3)

pinoyyid
pinoyyid

Reputation: 22306

Is there a reason you need to download the items before you update them?

Given you have the file ID, you can simply PUT your changes.

Upvotes: 0

Claudio Cherubino
Claudio Cherubino

Reputation: 15024

You can add all those files to a specific folder and then search for them using the parents field of a search query, as in:

'1234567' in parents

that returns all files that are contained in the folder with ID 1234567.

Upvotes: 1

pinoyyid
pinoyyid

Reputation: 22306

You could wrap all of the file/get/put calls into a single batch. https://developers.google.com/google-apps/documents-list/#batching_resource_operations_into_a_single_request

Upvotes: 1

Related Questions