I'm working with a Google Service Account, I have access to Google Drive API and a Shared Unit.
I need to get access to all the files and folders from a Shared Unit. I tried a lot of different ways to do this.
drive_service.files().list(
q = f"'{parent_folder}' in parents",
spaces = 'drive',
supportsTeamDrives=True
).execute()
>> {'kind': 'drive#fileList', 'incompleteSearch': False, 'files': []}
drive_service.files().list(
q = f" parents in '{parent_folder}'",
spaces = 'drive',
supportsTeamDrives=True
).execute()
>> {'kind': 'drive#fileList', 'incompleteSearch': False, 'files': []}
drive_service.files().list(
spaces = 'drive',
supportsTeamDrives=True
).execute()
>> {'kind': 'drive#fileList', 'incompleteSearch': False, 'files': []}
drive_service.drives().list().execute()
>> {'kind': 'drive#driveList',
'drives': [{'kind': 'drive#drive',
'id': '0AOELwkzr21lFUk9VA',
'name': 'foo'}]}
I know a have access because I can upload files to the parent folder. Also, there are files in the parent folder.
Do you have any clue?
Thank you for your time
I figure it out.
An additional parameter had to be passed:
includeItemsFromAllDrives = True,
supportsAllDrives = True
This works:
drive_service.files().list(
q = f"'{parent_folder}' in parents",
spaces = 'drive',
includeItemsFromAllDrives = True,
supportsAllDrives = True
).execute()