Google Drive API - Search only your own files
tmp = files
for file in files:
if not file['parents']:
tmp.remove(file)
return tmp
Update 12/06/2013: Just verify this method, it's wrong (files of a shared folder has parents too). So, user 'owners' attribute instead to check the owners is the authenticated user:
def retrieve_own_files(service):
tmp = []
allfiles = search_files(service, "trashed = false")
if allfiles:
for file in allfiles:
if file['owners'][0]['isAuthenticatedUser']:
tmp.append()
return tmp
This is how I solve the issue. Maybe there are many better ways out there, but for now, I just use it.
Comments
Post a Comment