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 owner in 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 ?

with google drive api v3 full resources no longer returned default. use fields query parameter request specific fields returned. if left unspecified subset of commonly used fields returned.

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

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -