Incomplete Google Drive REST API results for Team Drive files -
problem
during first phase of team drive backup system, first need scan files in given team drive in order determine files copy backup.
i (think?) have full permissions on files & folders of team drive, due credentials use (set
ownerin cloud console).
nevertheless, problem when query rest api file listing of given team drive, results not comply documentation. returned file objects contain 5 fields are:
kind,name,id,mimetype,teamdriveid
according documentation provided, should receive handful more of fields.
below code use query api , output.
simplified source
credentials = get_credentials() # retrieves , processes app credentials drive = get_drive_api(credentials) # drive api v3 using httplib2 , discovery query = drive.files().list( pagesize = 10, corpora = 'teamdrive', supportsteamdriveitems = true, includeteamdrives = true, teamdriveid = "..." ) results = query.execute() # contact rest api files = results.get('files', []) file in files: print(file) for given team drive, output is
{ 'kind': 'drive#file', 'id': '...', 'name': 'filename', 'mimetype': 'application/vnd.google-apps.document', 'teamdriveid': '...' } which isn't expected output according docs.
any insights on reason not complete expected data ?
to fetch available fields of resource can set fields *.
for example:
query = drive.files().list( pagesize = 10, corpora = 'teamdrive', supportsteamdriveitems = true, includeteamdrives = true, teamdriveid = "...", fields="*" # or maybe "files(id,name,capabilities/canshare),nextpagetoken" )
Comments
Post a Comment