Reputation: 5592
I am trying to get a list of all folder titles/ids in a specific Google Drive folder.
What i have found, that almost resembles what i need is the following: https://developers.google.com/drive/v2/reference/children/list
From that page i can type in the start folder and i can also add a mimetype to the query string: mimeType = 'application/vnd.google-apps.folder' to return only folders.
The problem is that i only get back a set of ID's. That isn't very practical since i can not display them to the user in a dropdown list. Is there any other method to actually get the title of the folders (along with the ID's)?
Something like:
{
"kind": "drive#childReference",
"id": string,
"selfLink": string,
"childLink": string,
"title": string <-----
}
What is the best way to solve this, do one request for every folder (a lot of folders) each time i need to populate the dropdown list?
Upvotes: 2
Views: 4763
Reputation: 8289
You can use the files#list method with a in parents
search parameter, like described here. You can combine that with the mimeType
option that you mentioned.
It will return a lot of information, you'll probably want to specify the fields
parameter as well to get only what you need.
Upvotes: 4