some_id
some_id

Reputation: 29896

Google Drive - Accessing file tree entries and their type

How does one retrieve the file tree for a google drive account using the Google Drive iOS API?

I am able to access the list of files from what I have read on the developer site for Google Drive and through the sample apps, but I am not sure how one gets the file tree and how to distinguish if an entry is a folder or file.

Upvotes: 0

Views: 344

Answers (1)

Claudio Cherubino
Claudio Cherubino

Reputation: 15024

You can check the mimeType property of the file resource to distinguish between files and folders. Folders will list application/vnd.google-apps.folder as their MIME type:

https://developers.google.com/drive/folder

You can use the Parents collection to list the parents of a file and build a tree. Remember that a file can have multiple parents, i.e. be included in multiple folders:

https://developers.google.com/drive/v2/reference/parents/list

Upvotes: 1

Related Questions