I think that I should use files.list request with "q" parameter. I don't know which value of q parameter I should to set.
2 Answers
For this you can give the value in q
parameter. In this you can verify with the sharedWithMe
field. Check this document for reference.
Hope that helps!

- 510
- 5
- 14

- 4,647
- 2
- 14
- 14
-
3Is it possible to search for files 'not' sharedWithMe? – JayIsTooCommon Jun 07 '16 at 14:05
-
@JayIsTooCommon: Yes, `sharedWithMe` is a boolean, so you can query for true or false. See query fields for `files.list` at https://developers.google.com/drive/api/v3/search-parameters – labroid May 25 '18 at 22:28
sharedWithMe
still works with v3 API, but the problem with it is that it only returns the root shared files or folders. So if someone has shared their folder with you, you only receive that folder - not its contents - with sharedWithMe = true
query.
I found using "not 'me' in owners"
with the default user
corpora much better as it returns all files that you don't own which, as it happens, are by definition what the Shared with me
files are. If you owned it, it would reside inside your drive.
EDIT: There's a nasty bug here you can trip on like I did. By default includeItemsFromAllDrives
is set to false
and it works when fetching Shared With Me
files. However, if you want to fetch files from Shared Drives as well, you have to use includeItemsFromAllDrives = true
in order to do so. If you forget to explicitly set it back to includeItemsFromAllDrives = false
when fetching Shared With Me
files you'll be refetching the same contents as in the Shared Drives. So be aware.

- 2,095
- 1
- 18
- 17