Skip to main content

parents

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

Overview

Nameparents
TypeResource
Idgoogleworkspace.drivev2.parents

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the parent.
isRootbooleanOutput only. Whether or not the parent is the root folder.
kindstringOutput only. This is always drive#parentReference. (default: drive#parentReference)
parentLinkstringOutput only. A link to the parent.
selfLinkstringOutput only. A link back to this reference.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileId, parentIdGets a specific parent reference.
listselectfileIdLists a file's parents.
insertinsertfileIdenforceSingleParent, supportsAllDrives, supportsTeamDrivesAdds a parent folder for a file.
deletedeletefileId, parentIdenforceSingleParentRemoves a parent from a file.

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
fileIdstring
parentIdstring
enforceSingleParentboolean
supportsAllDrivesboolean
supportsTeamDrivesboolean

SELECT examples

Gets a specific parent reference.

SELECT
id,
isRoot,
kind,
parentLink,
selfLink
FROM googleworkspace.drivev2.parents
WHERE fileId = '{{ fileId }}' -- required
AND parentId = '{{ parentId }}' -- required
;

INSERT examples

Adds a parent folder for a file.

INSERT INTO googleworkspace.drivev2.parents (
data__selfLink,
data__id,
data__isRoot,
data__kind,
data__parentLink,
fileId,
enforceSingleParent,
supportsAllDrives,
supportsTeamDrives
)
SELECT
'{{ selfLink }}',
'{{ id }}',
{{ isRoot }},
'{{ kind }}',
'{{ parentLink }}',
'{{ fileId }}',
'{{ enforceSingleParent }}',
'{{ supportsAllDrives }}',
'{{ supportsTeamDrives }}'
RETURNING
id,
isRoot,
kind,
parentLink,
selfLink
;

DELETE examples

Removes a parent from a file.

DELETE FROM googleworkspace.drivev2.parents
WHERE fileId = '{{ fileId }}' --required
AND parentId = '{{ parentId }}' --required
AND enforceSingleParent = '{{ enforceSingleParent }}'
;