在查找并找到与给定名称匹配的共享文件夹后,我需要知道该文件夹的创建者/所有者是否是特定的Google帐户。如何利用Google Drive的Objective-C SDK实现这一目标。
这是我的查询,它找到了名称的共享文件夹:
GTLQueryDrive *queryDrive = [GTLQueryDrive queryForFilesList];
queryDrive.q = @"mimeType='application/vnd.google-apps.folder' and trashed=false";
[self.service executeQuery:queryDrive completionHandler:^(GTLServiceTicket *ticket,
GTLDriveFileList *files,
NSError *error) {
if (error == nil)
{
NSString *identifier = @"";
for(GTLDriveFile *file in files.files)
{
NSArray *tempArray = [NSArray arrayWithArray:file.owners];
NSLog(@"File Title: %@ | ID: %@",file.name , file.identifier);
if ([file.name isEqualToString:@"GIVEN FOLDER NAME"]) {
identifier = file.identifier;
//How to know if the found folder is owned by a specified email?
break;
}
}
if ([identifier isEqualToString:@""]) {
[UISpinningWheelController removeSpinningWheel:self.view];
[self showAlertWithTitle:@"Error" andMessage:@"The required folder has not been shared with this Google account. Please contact the administrator."];
}
}
else {
[UISpinningWheelController removeSpinningWheel:self.view];
[self showAlertWithTitle:@"Error" andMessage:[error localizedDescription]];
}
}];
非常感谢你的帮助。