I am using Python to list out files shared with my google service account.
The process is working fine except that one file that I know is shared with my service account is not coming up in the output list.
The file is not owned by me so there is a limit to what I can show and trial, the one thing I have noticed is that the problem file "belongs to a shared drive" whereas the others do not. Also the "share" interface is very different to the one I am used to, I think again due to it being in a shared drive space.
Screenshots, the problem file share interface is all red/maroon unlike the normal ice blue/grey you get.
Shared drive file: share file interface

Non shared drive file: share interface

When I share the file with a "normal" google account it comes up in the drive UI in the shared with me area no issue.
My guess is there is some sort of hierarchy of permissions on the drive that is blocking my service account, hopefully though there is a simpler solution.
Things I've tried:
I have already asked the owner to add my service account email themselves, this did not change anything.
I have tried various string query changes like "sharedWithMe" and also looking in the appData location as well as drive.
If I share the file with a normal google user I can access it through the google drive "shared with me" area, so it is definitely "shared".
If I copy the file to my own area and share the file with the service account, the copy does appear in the output.
listing files code for reference
scope = 'https://www.googleapis.com/auth/drive.readonly'
api_name = 'drive'
api_version = 'v3'
##### I have a separate service builder function that is working fine
results = self.service.files().list(
pageSize=1000, fields="nextPageToken, files(id, name, shared,
mimeType)").execute()
self.files = results.get('files', [])
if not self.files:
print('No files found.')
else:
print('Files:')
for file in self.files:
print(u'{0} ({1})'.format(file['name'], file['id']))
I expect the shared drive file to be listed in the output, but it is not. Other files are listing correctly.