def doDriveSearch(drive, user, i, count, query=None, parentQuery=False, orderBy=None, teamDriveOnly=False, **kwargs):
if GC.Values[GC.SHOW_GETTINGS]:
printGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, i, count, query=query)
try:
files = callGAPIpages(drive.files(), u'list', VX_PAGES_FILES,
page_message=getPageMessageForWhom(noNL=True),
throw_reasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.INVALID_QUERY, GAPI.INVALID, GAPI.FILE_NOT_FOUND, GAPI.TEAMDRIVE_NOT_FOUND],
q=query, orderBy=orderBy, fields=u'nextPageToken,files(id,teamDriveId)', pageSize=GC.Values[GC.DRIVE_MAX_RESULTS], **kwargs)
if files or not parentQuery:
return [f_file[u'id'] for f_file in files if not teamDriveOnly or f_file.get(u'teamDriveId')]
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE, None], invalidQuery(query), i, count)
except (GAPI.invalidQuery, GAPI.invalid):
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE, None], invalidQuery(query), i, count)
except GAPI.fileNotFound:
printGotEntityItemsForWhom(0)
except GAPI.teamDriveNotFound as e:
entityActionFailedWarning([Ent.USER, user, Ent.TEAMDRIVE_ID, kwargs[u'teamDriveId']], str(e), i, count)
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
return None
评论列表
文章目录