I just started using Google Drive API. I walked throughout installation and setup guide and right now I can use this beautiful service on my iOS application.
My goal is: load all files for specified directory.
I have found example how to get load filed for the root directory and it works perfect, I really like this code:
- (void)loadDriveFiles
{
GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = [NSString stringWithFormat:@"'%@' IN parents ", @"root"];
[self.driveService executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLDriveFileList *files,
NSError *error)
{
if (error == nil)
{
_driveFiles = [[NSMutableArray alloc] init];
[_driveFiles addObjectsFromArray:files.items];
for (GTLDriveFile *file in _driveFiles)
{
NSLog(@"title: %@", file.title);
NSLog(@"mimeType: %@", file.mimeType);
}
}
else
{
NSLog(@"An error occurred: %@", error);
}
}];
}
For load all files I have init GTMOAuth2ViewControllerTouch
with kGTLAuthScopeDrive
instead of kGTLAuthScopeDriveFile
as they use for quick start tutorial.
So the code above works perfect as I said, but my question is how I can replace "root" with folder id. I suppose that the GTLDriveFile
object has this information, but I still have not find it. I figured out with mimeType, so I can check if the GTLDriveFile
is a folder or not using this key/value:
mimeType:"application/vnd.google-apps.folder"
but where can I find folder id? so I just played with hardcode folder id copying it from browser and it also worked for me, but I want to create table with cells which will contain folder id info, and by pressing this cell I will open folder based on the folder id that cell belongs. For this I need to know how to find folder id as I suppose. I think the users from android group also can suggest something.