Reputation: 906
I know Google Drive API will enforce an update in the Mid of 2020. However, I am very confused about the Drive API document, as described in Files.list and Changes.list :
supportsAllDrives : Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives. (Default: false)
includeItemsFromAllDrives: Deprecated - Whether both My Drive and shared drive items should be included in results. This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results. (Default: false)
My questions are:
Does this mean the supportsAllDrives & includeItemsFromAllDrives will automatically become true after Jun 1,2020, if these two parameters are not included (or are set to false) in the API requests?
Before Jun 1, 2020, we can easily retrieve files only in "My Drive" (without files in shared drives) by setting supportsAllDrives & includeItemsFromAllDrives to false. But after Jun 1, 2020, how can I retrieve files only in "My Drive"?? I know we can filter the result returned by the Files.list requests to get rid of the files in shared drives, but it is very inefficient. There should be a direct method to get the file list in "My Drive" only.
Upvotes: 3
Views: 2928
Reputation: 31
It looks like the deprecations have been revoked. At least I can no longer find these Google Drive API notes in the API description and the parameters "includeItemsFromAllDrives" and "supportsAllDrives" are still present.
Upvotes: 2
Reputation: 2014
1 - supportAllDrives & includeItemsFromAllDrives will become true by default.
2 - Since there is no direct method to retrieve your own files, you have to use the q parameter on the Drive : list.
You have two options:
'root' in parents
This will get you the files and folders you have on your My Drive excluding the shared ones, but it will not show files inside folders, just the ones in the front page of My Drive.
Best approach:
'me' in owners
This will get you all the files you own. This is the best option since you can't enforce an owner to a shared drive item.
If you try to enforce yourself as an owner of a shared drive item, this is what you will get:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "ownerOnTeamDriveItemNotSupported",
"message": "Owner role is invalid for shared drive items."
}
],
"code": 403,
"message": "Owner role is invalid for shared drive items."
}
}
Quoting the documentation:
owners
,ownerNames
,ownedByMe
— Files within a shared drive are owned by the shared drive, not individual users.
A part from that i recommend you to also use trashed = false
in the q parameter, to be sure no trashed files appear on your search.
If you want to file this as a feature request you can go to Issue Tracker
Upvotes: 6