This guide contains tasks related to managing shared drives, such as creating shared drives and managing members and permissions.
For more information about shared drive folder limits, see Folder limits.
Create shared drives
To create a shared drive, use the drives.create
method.
Java
Python
Node.js
PHP
.NET
Calls to the drives.create
method are
idempotent.
The requestId
parameter identifies the logical attempt to create the shared
drive. If the request times out or returns an indeterminate backend error, the
same request can be repeated. The requestId
and body of the request must
remain the same.
If the shared drive was successfully created on a previous request or due to a
retry, the normal response is returned. Sometimes, such as after a prolonged
time or if the body of the request has changed, a 409
error might be
returned indicating the requestId
must be discarded.
Add or remove shared drive members
Add or remove shared drive members using the
permissions
resource.
To add a member, create the permission on the shared drive. Permission methods can also be used on individual files within a shared drive to grant members additional privileges or allow non-members to collaborate on specific items.
For more information and sample code, see Share files, folders, and drives.
Delete a shared drive
Use the drives.delete
method to delete a
shared drive. All content in the shared drive must be moved to trash or deleted
prior to deleting the shared drive.
Manage shared drives for domain administrators
Apply the useDomainAdminAccess
parameter with the drives
and permissions
resources to manage shared drives across an
organization.
Users calling these methods with useDomainAdminAccess=true
must have the
Drive and Docs
administrator
privilege.
Administrators can search for shared
drives or update permissions for shared
drives owned by their organization, regardless of the administrator's membership
in any given shared drive.
Recover a shared drive that doesn't have an organizer
The following example demonstrates how to use these resources to recover shared drives that no longer have an organizer.
Java
Python
Node.js
PHP
.NET
Folder limits
Shared drive folders have some storage limits. For information, see Shared drive limits in Google Drive.
Item cap
Each folder in a user's shared drive has a limit of 500,000 items, including files, folders, and shortcuts.
When the limit is reached, the shared drive can no longer accept items. To receive files again, users must permanently delete items from the folder. Note that items in the trash count toward the limit but permanently-deleted items don't. For more information, see Trash or delete files and folders.
Folder-depth limit
A folder in a shared drive can't contain more than 100 levels of nested folders. This means that a child folder cannot be stored under a folder that's more than 99 levels deep. This limitation only applies to child folders.
Attempts to add more than 100 levels of folders returns a
teamDriveHierarchyTooDeep
HTTP status code response.