Skip to main content

drives

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

Overview

Namedrives
TypeResource
Idgoogleworkspace.drivev2.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.
createdDatestring (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. This is always 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.
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.insert 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.
listselectmaxResults, 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.
insertinsertrequestIdCreates a new shared drive.
updatereplacedriveIduseDomainAdminAccessUpdates the metadata for a shared drive.
deletedeletedriveIduseDomainAdminAccess, allowItemDeletionPermanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.
hideexecdriveIdHides a shared drive from the default view.
unhideexecdriveIdRestores a shared drive to the default view.

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
maxResultsinteger (int32)
pageTokenstring
qstring
useDomainAdminAccessboolean

SELECT examples

Gets a shared drive's metadata by ID.

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

INSERT examples

Creates a new shared drive.

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

REPLACE examples

Updates the metadata for a shared drive.

REPLACE googleworkspace.drivev2.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__createdDate = '{{ createdDate }}',
data__hidden = {{ hidden }},
data__restrictions = '{{ restrictions }}',
data__orgUnitId = '{{ orgUnitId }}'
WHERE
driveId = '{{ driveId }}' --required
AND useDomainAdminAccess = {{ useDomainAdminAccess}}
RETURNING
id,
name,
backgroundImageFile,
backgroundImageLink,
capabilities,
colorRgb,
createdDate,
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.

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

Lifecycle Methods

Hides a shared drive from the default view.

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