To support shared drives in your application, you must make a number of changes so that your app can create and manage shared drives and files that they contain.
If you don't upgrade your application, it will continue to be supported in a backwards-compatible manner, but it will not be able to access shared drives or files contained within shared drives.
Because shared drives follow different organization, sharing, and ownership models, some operations are not permitted for content in a shared drive. Additionally, fields related to permissions and ownership are populated differently.
The following fields are only populated for files located within a shared drive:
hasAugmentedPermissions— Whether any users are granted file access directly on this file.
capabilities/canDeleteChildren— Whether the current user can delete children of this folder.
capabilities/canMoveChildrenOutOfDrive— Whether the current user can move children of this folder outside of the shared drive.
capabilities/canMoveChildrenWithinDrive— Whether the current user can move children of this folder within the shared drive.
capabilities/canMoveItemWithinDrive— Whether the current user can move this shared drive item within the shared drive.
capabilities/canReadDrive— Whether the current user has read access to the shared drive to which this file belongs.
capabilities/canTrashChildren— Whether the current user can trash children of this folder.
driveId— The ID of the shared drive within which the file is located.
trashingUser— If the file has been explicitly trashed, the user who trashed it.
trashedTime— The time that the item was trashed.
The following fields are not populated for files located within a shared drive:
permissions— Due to the potential size of shared drive ACLs, permissions are not returned as part of files. Use the
permissions.listmethod, which supports pagination, to list permissions for a file within a shared drive or the shared drive itself.
ownedByMe— Files within a shared drive are owned by the shared drive, not individual users.
folderColorRgb— Folders cannot be colored individually
shared— All items in a shared drive are shared.
writersCanShare— It is currently not possible to restrict sharing by role in shared drives.
The following fields are only set when the user has been granted file access permissions on an item:
The following fields require special consideration when you use them with shared drives:
parents.isRoot— This field is only true for the My Drive root folder; it is false for the shared drive top-level folder.
parents— A parent does not appear in the parents list if the requesting user is a not a member of the shared drive and does not have access to the parent. In addition, with the exception of the top level folder, the parents list must contain exactly one item if the file is located within a shared drive.
The following field is only populated for files located within a shared drive:
permissionDetails— A list of condensed Permissions that are on or inherited by this shared drive file. This is an output-only field which is present only for shared drive items.
- Two new roles of
fileOrganizerhave been defined.
permissions.listnow supports pagination.
The following new fields are available:
changeType— The type of the change. Possible values are
driveId— The ID of the shared drive associated with this change.
drive— The updated state of the shared drive. Present if the
driveand the user is still a member of the shared drive.
Additional changes may be required for applications that need to sync content with shared drives or track activity. See track changes for users and shared drives for details.
Opt-in to shared drive content
To access content that is contained in a shared drive, you need to make changes to your app. The size of this change depends on whether your app is affected by the behavioral changes associated with shared drives.
Apps unaffected by shared drive behavior
If your application isn't affected by the behavioral differences,
then you only need to include the
supportsAllDrives=true query parameter in requests. This is an
acknowledgement that the application is aware of behavioral differences
of files contained in shared drives.
The following methods require
supportsAllDrives=true when working with
shared drives content:
Apps that are affected by shared drive behavior
Applications that read or modify permissions, track changes, or need to search across multiple corpora require additional changes. The following sections highlight the changes that may be required for some apps.
Including shared drive content
Using shared drives adds the capability to search files within a specific shared drive or search across all shared drives.
files.list request has several parameters specific to shared drives:
driveId— ID of shared drive to search.
includeItemsFromAllDrives— Whether shared drive items should be included in results. If not present or set to false, then shared drive items are not returned. Note: On June 1, 2020, this parameter will be ignored and shared drive items will be returned in results.
corpora— Bodies of items (files/documents) to which the query applies. Supported bodies are
supportsAllDrives— Whether the requesting application supports both My Drives and shared drives. If false, then shared drive items are not included in the response. Note: On June 1, 2020, this parameter will be ignored and all applications are assumed to support shared drives.
The following query modes are specific to shared drives:
||Queries files that the user has accessed, including both shared drive and My Drive files.|
||Queries all items in the specified shared drive. driveId must be specified in the request.|
||Queries files that the user has accessed and all shared drives in which they are a member. Note that the response may include
||Queries files that are shared to the domain, including both shared drive and My Drive files.|
Tracking changes in shared drivesThe
changes.listmethod has several parameters specific to shared drives:
driveId— The shared drive from which changes will be returned. If specified, the change IDs refer to changes within the shared drive, not changes to the files seen by the user. To refer to a specific shared drive change, both the shared drive ID and change ID must be used as an identifier.
supportsAllDrives— Whether the requesting application supports shared drives. If false, then shared drive items, including both shared drives and files within a shared drive, are not returned.
includeItemsFromAllDrives— Whether shared drive files or changes should be included in the list of changes.
The following query modes are specific to shared drives:
includeItemsFromAllDrives=true— Changes are reflective of changes to files inside or outside of shared drives that the user has accessed, as well as changes to shared drives in which the user is a member.
driveIdis specified — Changes are reflective of changes to the particular shared drive that was specified and items inside that shared drive.
For additional details about change log behavior, see Change Logs.
Enabling "new" and "open with" support in Drive
Drive apps must also acknowledge shared drive support in the Google Cloud Console.
To enable UI integration for content in shared drives, check the
shared drives support
option on the
Drive UI Integration settings page.