def _getDriveFileNameFromId(drive, fileId, combineTitleId=True):
try:
result = callGAPI(drive.files(), u'get',
throw_reasons=GAPI.DRIVE_ACCESS_THROW_REASONS,
fileId=fileId, fields=VX_FILENAME_MIMETYPE_TEAMDRIVEID, supportsTeamDrives=True)
if result:
fileName = result[VX_FILENAME]
if (result[u'mimeType'] == MIMETYPE_GA_FOLDER) and (result[VX_FILENAME] == TEAM_DRIVE) and result.get(u'teamDriveId'):
fileName = _getTeamDriveNameFromId(drive, result[u'teamDriveId'])
if combineTitleId:
fileName += u'('+fileId+u')'
return (fileName, _getEntityMimeType(result))
except (GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.internalError,
GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy):
pass
return (fileId, Ent.DRIVE_FILE_OR_FOLDER_ID)
评论列表
文章目录