I have tried to get the list of folders with Google Drive API in Python. I can get the list in my drive folders but I can not get the list of items of shared folders. I use GCP service account for credential and I already set the service account into shared folder. Anyone has solutions?? Should I use another parameter?? Thank you so much.
drive = build('drive', 'v3', credentials=credentials)
folderId = "xxxxxxxxxxx"
query = f"parents = '{folderId}'"
response = drive.files().list(q=query,includeItemsFromAllDrives=True,supportsAllDrives=True).execute()
files = response.get('files')
nextPageToken = response.get('nextPageToken')
while nextPageToken:
response = drive.files().list(q=query,includeItemsFromAllDrives=True,supportsAllDrives=True).execute()
files.extend(response.get('files'))
nextPageToken = response.get('nextPageToken')
df = pd.DataFrame(files)