Skip to main content

drives

Creates, updates, deletes, gets or lists a drives resource.

Overview

Namedrives
TypeResource
Idgoogleworkspace.drivev3.drives

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringOutput only. The ID of this shared drive which is also the ID of the top level folder of this shared drive.
namestringThe name of this shared drive.
backgroundImageFileobjectAn image file and cropping parameters from which a background image for this shared drive is set. This is a write only field; it can only be set on drive.drives.update requests that don't set themeId. When specified, all fields of the backgroundImageFile must be set.
backgroundImageLinkstringOutput only. A short-lived link to this shared drive's background image.
capabilitiesobjectOutput only. Capabilities the current user has on this shared drive.
colorRgbstringThe color of this shared drive as an RGB hex string. It can only be set on a drive.drives.update request that does not set themeId.
createdTimestring (date-time)The time at which the shared drive was created (RFC 3339 date-time).
hiddenbooleanWhether the shared drive is hidden from default view.
kindstringOutput only. Identifies what kind of resource this is. Value: the fixed string "drive#drive". (default: drive#drive)
orgUnitIdstringOutput only. The organizational unit of this shared drive. This field is only populated on drives.list responses when the useDomainAdminAccess parameter is set to true.
restrictionsobjectA set of restrictions that apply to this shared drive or items inside this shared drive. Note that restrictions can't be set when creating a shared drive. To add a restriction, first create a shared drive and then use drives.update to add restrictions.
themeIdstringThe ID of the theme from which the background image and color will be set. The set of possible driveThemes can be retrieved from a drive.about.get response. When not specified on a drive.drives.create request, a random theme is chosen from which the background image and color are set. This is a write-only field; it can only be set on requests that don't set colorRgb or backgroundImageFile.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectdriveIduseDomainAdminAccessGets a shared drive's metadata by ID. For more information, see Manage shared drives.
listselectpageSize, pageToken, q, useDomainAdminAccess Lists the user's shared drives. This method accepts the q parameter, which is a search query combining one or more search terms. For more information, see the Search for shared drives guide.
createinsertrequestIdCreates a shared drive. For more information, see Manage shared drives.
updateupdatedriveIduseDomainAdminAccessUpdates the metadata for a shared drive. For more information, see Manage shared drives.
deletedeletedriveIduseDomainAdminAccess, allowItemDeletionPermanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items. For more information, see Manage shared drives.
hideexecdriveIdHides a shared drive from the default view. For more information, see Manage shared drives.
unhideexecdriveIdRestores a shared drive to the default view. For more information, see Manage shared drives.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
driveIdstring
requestIdstring
allowItemDeletionboolean
pageSizeinteger (int32)
pageTokenstring
qstring
useDomainAdminAccessboolean

SELECT examples

Gets a shared drive's metadata by ID. For more information, see Manage shared drives.

SELECT
id,
name,
backgroundImageFile,
backgroundImageLink,
capabilities,
colorRgb,
createdTime,
hidden,
kind,
orgUnitId,
restrictions,
themeId
FROM googleworkspace.drivev3.drives
WHERE driveId = '{{ driveId }}' -- required
AND useDomainAdminAccess = '{{ useDomainAdminAccess }}'
;

INSERT examples

Creates a shared drive. For more information, see Manage shared drives.

INSERT INTO googleworkspace.drivev3.drives (
data__id,
data__name,
data__colorRgb,
data__kind,
data__backgroundImageLink,
data__capabilities,
data__themeId,
data__backgroundImageFile,
data__createdTime,
data__hidden,
data__restrictions,
data__orgUnitId,
requestId
)
SELECT
'{{ id }}',
'{{ name }}',
'{{ colorRgb }}',
'{{ kind }}',
'{{ backgroundImageLink }}',
'{{ capabilities }}',
'{{ themeId }}',
'{{ backgroundImageFile }}',
'{{ createdTime }}',
{{ hidden }},
'{{ restrictions }}',
'{{ orgUnitId }}',
'{{ requestId }}'
RETURNING
id,
name,
backgroundImageFile,
backgroundImageLink,
capabilities,
colorRgb,
createdTime,
hidden,
kind,
orgUnitId,
restrictions,
themeId
;

UPDATE examples

Updates the metadata for a shared drive. For more information, see Manage shared drives.

UPDATE googleworkspace.drivev3.drives
SET
data__id = '{{ id }}',
data__name = '{{ name }}',
data__colorRgb = '{{ colorRgb }}',
data__kind = '{{ kind }}',
data__backgroundImageLink = '{{ backgroundImageLink }}',
data__capabilities = '{{ capabilities }}',
data__themeId = '{{ themeId }}',
data__backgroundImageFile = '{{ backgroundImageFile }}',
data__createdTime = '{{ createdTime }}',
data__hidden = {{ hidden }},
data__restrictions = '{{ restrictions }}',
data__orgUnitId = '{{ orgUnitId }}'
WHERE
driveId = '{{ driveId }}' --required
AND useDomainAdminAccess = {{ useDomainAdminAccess}}
RETURNING
id,
name,
backgroundImageFile,
backgroundImageLink,
capabilities,
colorRgb,
createdTime,
hidden,
kind,
orgUnitId,
restrictions,
themeId;

DELETE examples

Permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items. For more information, see Manage shared drives.

DELETE FROM googleworkspace.drivev3.drives
WHERE driveId = '{{ driveId }}' --required
AND useDomainAdminAccess = '{{ useDomainAdminAccess }}'
AND allowItemDeletion = '{{ allowItemDeletion }}'
;

Lifecycle Methods

Hides a shared drive from the default view. For more information, see Manage shared drives.

EXEC googleworkspace.drivev3.drives.hide 
@driveId='{{ driveId }}' --required
;