files
Creates, updates, deletes, gets or lists a files
resource.
Overview
Name | files |
Type | Resource |
Id | googleworkspace.drivev2.files |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Name | Datatype | Description |
---|---|---|
id | string | The ID of the file. |
alternateLink | string | Output only. A link for opening the file in a relevant Google editor or viewer. |
appDataContents | boolean | Output only. Whether this file is in the Application Data folder. |
canComment | boolean | Output only. Deprecated: Use capabilities/canComment instead. |
canReadRevisions | boolean | Output only. Deprecated: Use capabilities/canReadRevisions instead. |
capabilities | object | Output only. Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take. |
contentRestrictions | array | Restrictions for accessing the content of the file. Only populated if such a restriction exists. |
copyRequiresWriterPermission | boolean | Whether the options to copy, print, or download this file, should be disabled for readers and commenters. |
copyable | boolean | Output only. Deprecated: Use capabilities/canCopy instead. |
createdDate | string (date-time) | Create time for this file (formatted RFC 3339 timestamp). |
defaultOpenWithLink | string | Output only. A link to open this file with the user's default app for this file. Only populated when the drive.apps.readonly scope is used. |
description | string | A short description of the file. |
downloadUrl | string | Output only. Short lived download URL for the file. This field is only populated for files with content stored in Google Drive; it is not populated for Google Docs or shortcut files. |
driveId | string | Output only. ID of the shared drive the file resides in. Only populated for items in shared drives. |
editable | boolean | Output only. Deprecated: Use capabilities/canEdit instead. |
embedLink | string | Output only. A link for embedding the file. |
etag | string | Output only. ETag of the file. |
explicitlyTrashed | boolean | Output only. Whether this file has been explicitly trashed, as opposed to recursively trashed. |
exportLinks | object | Output only. Links for exporting Docs Editors files to specific formats. |
fileExtension | string | Output only. The final component of fullFileExtension with trailing text that does not appear to be part of the extension removed. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
fileSize | string (int64) | Output only. Size in bytes of blobs and first party editor files. Won't be populated for files that have no size, like shortcuts and folders. |
folderColorRgb | string | Folder color as an RGB hex string if the file is a folder or a shortcut to a folder. The list of supported colors is available in the folderColorPalette field of the About resource. If an unsupported color is specified, it will be changed to the closest color in the palette. |
fullFileExtension | string | Output only. The full file extension; extracted from the title. May contain multiple concatenated extensions, such as "tar.gz". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
hasAugmentedPermissions | boolean | Output only. Whether there are permissions directly on this file. This field is only populated for items in shared drives. |
hasThumbnail | boolean | Output only. Whether this file has a thumbnail. This does not indicate whether the requesting app has access to the thumbnail. To check access, look for the presence of the thumbnailLink field. |
headRevisionId | string | Output only. The ID of the file's head revision. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
iconLink | string | Output only. A link to the file's icon. |
imageMediaMetadata | object | Output only. Metadata about image media. This will only be present for image types, and its contents will depend on what can be parsed from the image content. |
indexableText | object | Indexable text attributes for the file (can only be written) |
inheritedPermissionsDisabled | boolean | Whether this file has inherited permissions disabled. Inherited permissions are enabled by default. |
isAppAuthorized | boolean | Output only. Whether the file was created or opened by the requesting app. |
kind | string | Output only. The type of file. This is always drive#file . (default: drive#file) |
labelInfo | object | Output only. An overview of the labels on the file. |
labels | object | A group of labels for the file. |
lastModifyingUser | object | Output only. The last user to modify this file. This field is only populated when the last modification was performed by a signed-in user. (id: User) |
lastModifyingUserName | string | Output only. Name of the last user to modify this file. |
lastViewedByMeDate | string (date-time) | Last time this file was viewed by the user (formatted RFC 3339 timestamp). |
linkShareMetadata | object | Contains details about the link URLs that clients are using to refer to this item. |
markedViewedByMeDate | string (date-time) | Deprecated. |
md5Checksum | string | Output only. An MD5 checksum for the content of this file. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
mimeType | string | The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type. |
modifiedByMeDate | string (date-time) | Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date. |
modifiedDate | string (date-time) | Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set. |
openWithLinks | object | Output only. A map of the id of each of the user's apps to a link to open this file with that app. Only populated when the drive.apps.readonly scope is used. |
originalFilename | string | The original filename of the uploaded content if available, or else the original value of the title field. This is only available for files with binary content in Google Drive. |
ownedByMe | boolean | Output only. Whether the file is owned by the current user. Not populated for items in shared drives. |
ownerNames | array | Output only. Name(s) of the owner(s) of this file. Not populated for items in shared drives. |
owners | array | Output only. The owner of this file. Only certain legacy files may have more than one owner. This field isn't populated for items in shared drives. |
parents | array | The ID of the parent folder containing the file. A file can only have one parent folder; specifying multiple parents isn't supported. If not specified as part of an insert request, the file is placed directly in the user's My Drive folder. If not specified as part of a copy request, the file inherits any discoverable parent of the source file. Update requests must use the addParents and removeParents parameters to modify the parents list. |
permissionIds | array | Output only. List of permission IDs for users with access to this file. |
permissions | array | Output only. The list of permissions for users with access to this file. Not populated for items in shared drives. |
properties | array | The list of properties. |
quotaBytesUsed | string (int64) | Output only. The number of quota bytes used by this file. |
resourceKey | string | Output only. A key needed to access the item via a shared link. |
selfLink | string | Output only. A link back to this file. |
sha1Checksum | string | Output only. The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
sha256Checksum | string | Output only. The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
shareable | boolean | Output only. Deprecated: Use capabilities/canShare instead. |
shared | boolean | Output only. Whether the file has been shared. Not populated for items in shared drives. |
sharedWithMeDate | string (date-time) | Time at which this file was shared with the user (formatted RFC 3339 timestamp). |
sharingUser | object | Information about a Drive user. (id: User) |
shortcutDetails | object | Shortcut file details. Only populated for shortcut files, which have the mimeType field set to application/vnd.google-apps.shortcut . Can only be set on files.insert requests. |
spaces | array | Output only. The list of spaces which contain the file. Supported values are drive , appDataFolder and photos . |
teamDriveId | string | Output only. Deprecated: Use driveId instead. |
thumbnail | object | A thumbnail for the file. This will only be used if a standard thumbnail cannot be generated. |
thumbnailLink | string | Output only. A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Not intended for direct usage on web applications due to Cross-Origin Resource Sharing (CORS), consider using a proxy server. Only populated when the requesting app can access the file's content. If the file isn't shared publicly, the URL returned in Files.thumbnailLink must be fetched using a credentialed request. |
thumbnailVersion | string (int64) | Output only. The thumbnail version for use in thumbnail cache invalidation. |
title | string | The title of this file. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the title is constant. |
trashedDate | string (date-time) | The time that the item was trashed (formatted RFC 3339 timestamp). Only populated for items in shared drives. |
trashingUser | object | Information about a Drive user. (id: User) |
userPermission | object | Output only. The permissions for the authenticated user on this file. (id: Permission) |
version | string (int64) | Output only. A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the requesting user. |
videoMediaMetadata | object | Output only. Metadata about video media. This will only be present for video types. |
webContentLink | string | Output only. A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials. |
webViewLink | string | Output only. A link only available on public folders for viewing their static web assets (HTML, CSS, JS, etc) via Google Drive's Website Hosting. |
writersCanShare | boolean | Whether writers can share the document with other users. Not populated for items in shared drives. |
Name | Datatype | Description |
---|---|---|
id | string | The ID of the file. |
alternateLink | string | Output only. A link for opening the file in a relevant Google editor or viewer. |
appDataContents | boolean | Output only. Whether this file is in the Application Data folder. |
canComment | boolean | Output only. Deprecated: Use capabilities/canComment instead. |
canReadRevisions | boolean | Output only. Deprecated: Use capabilities/canReadRevisions instead. |
capabilities | object | Output only. Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take. |
contentRestrictions | array | Restrictions for accessing the content of the file. Only populated if such a restriction exists. |
copyRequiresWriterPermission | boolean | Whether the options to copy, print, or download this file, should be disabled for readers and commenters. |
copyable | boolean | Output only. Deprecated: Use capabilities/canCopy instead. |
createdDate | string (date-time) | Create time for this file (formatted RFC 3339 timestamp). |
defaultOpenWithLink | string | Output only. A link to open this file with the user's default app for this file. Only populated when the drive.apps.readonly scope is used. |
description | string | A short description of the file. |
downloadUrl | string | Output only. Short lived download URL for the file. This field is only populated for files with content stored in Google Drive; it is not populated for Google Docs or shortcut files. |
driveId | string | Output only. ID of the shared drive the file resides in. Only populated for items in shared drives. |
editable | boolean | Output only. Deprecated: Use capabilities/canEdit instead. |
embedLink | string | Output only. A link for embedding the file. |
etag | string | Output only. ETag of the file. |
explicitlyTrashed | boolean | Output only. Whether this file has been explicitly trashed, as opposed to recursively trashed. |
exportLinks | object | Output only. Links for exporting Docs Editors files to specific formats. |
fileExtension | string | Output only. The final component of fullFileExtension with trailing text that does not appear to be part of the extension removed. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
fileSize | string (int64) | Output only. Size in bytes of blobs and first party editor files. Won't be populated for files that have no size, like shortcuts and folders. |
folderColorRgb | string | Folder color as an RGB hex string if the file is a folder or a shortcut to a folder. The list of supported colors is available in the folderColorPalette field of the About resource. If an unsupported color is specified, it will be changed to the closest color in the palette. |
fullFileExtension | string | Output only. The full file extension; extracted from the title. May contain multiple concatenated extensions, such as "tar.gz". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
hasAugmentedPermissions | boolean | Output only. Whether there are permissions directly on this file. This field is only populated for items in shared drives. |
hasThumbnail | boolean | Output only. Whether this file has a thumbnail. This does not indicate whether the requesting app has access to the thumbnail. To check access, look for the presence of the thumbnailLink field. |
headRevisionId | string | Output only. The ID of the file's head revision. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
iconLink | string | Output only. A link to the file's icon. |
imageMediaMetadata | object | Output only. Metadata about image media. This will only be present for image types, and its contents will depend on what can be parsed from the image content. |
indexableText | object | Indexable text attributes for the file (can only be written) |
inheritedPermissionsDisabled | boolean | Whether this file has inherited permissions disabled. Inherited permissions are enabled by default. |
isAppAuthorized | boolean | Output only. Whether the file was created or opened by the requesting app. |
kind | string | Output only. The type of file. This is always drive#file . (default: drive#file) |
labelInfo | object | Output only. An overview of the labels on the file. |
labels | object | A group of labels for the file. |
lastModifyingUser | object | Output only. The last user to modify this file. This field is only populated when the last modification was performed by a signed-in user. (id: User) |
lastModifyingUserName | string | Output only. Name of the last user to modify this file. |
lastViewedByMeDate | string (date-time) | Last time this file was viewed by the user (formatted RFC 3339 timestamp). |
linkShareMetadata | object | Contains details about the link URLs that clients are using to refer to this item. |
markedViewedByMeDate | string (date-time) | Deprecated. |
md5Checksum | string | Output only. An MD5 checksum for the content of this file. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
mimeType | string | The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type. |
modifiedByMeDate | string (date-time) | Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date. |
modifiedDate | string (date-time) | Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set. |
openWithLinks | object | Output only. A map of the id of each of the user's apps to a link to open this file with that app. Only populated when the drive.apps.readonly scope is used. |
originalFilename | string | The original filename of the uploaded content if available, or else the original value of the title field. This is only available for files with binary content in Google Drive. |
ownedByMe | boolean | Output only. Whether the file is owned by the current user. Not populated for items in shared drives. |
ownerNames | array | Output only. Name(s) of the owner(s) of this file. Not populated for items in shared drives. |
owners | array | Output only. The owner of this file. Only certain legacy files may have more than one owner. This field isn't populated for items in shared drives. |
parents | array | The ID of the parent folder containing the file. A file can only have one parent folder; specifying multiple parents isn't supported. If not specified as part of an insert request, the file is placed directly in the user's My Drive folder. If not specified as part of a copy request, the file inherits any discoverable parent of the source file. Update requests must use the addParents and removeParents parameters to modify the parents list. |
permissionIds | array | Output only. List of permission IDs for users with access to this file. |
permissions | array | Output only. The list of permissions for users with access to this file. Not populated for items in shared drives. |
properties | array | The list of properties. |
quotaBytesUsed | string (int64) | Output only. The number of quota bytes used by this file. |
resourceKey | string | Output only. A key needed to access the item via a shared link. |
selfLink | string | Output only. A link back to this file. |
sha1Checksum | string | Output only. The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
sha256Checksum | string | Output only. The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
shareable | boolean | Output only. Deprecated: Use capabilities/canShare instead. |
shared | boolean | Output only. Whether the file has been shared. Not populated for items in shared drives. |
sharedWithMeDate | string (date-time) | Time at which this file was shared with the user (formatted RFC 3339 timestamp). |
sharingUser | object | Information about a Drive user. (id: User) |
shortcutDetails | object | Shortcut file details. Only populated for shortcut files, which have the mimeType field set to application/vnd.google-apps.shortcut . Can only be set on files.insert requests. |
spaces | array | Output only. The list of spaces which contain the file. Supported values are drive , appDataFolder and photos . |
teamDriveId | string | Output only. Deprecated: Use driveId instead. |
thumbnail | object | A thumbnail for the file. This will only be used if a standard thumbnail cannot be generated. |
thumbnailLink | string | Output only. A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Not intended for direct usage on web applications due to Cross-Origin Resource Sharing (CORS), consider using a proxy server. Only populated when the requesting app can access the file's content. If the file isn't shared publicly, the URL returned in Files.thumbnailLink must be fetched using a credentialed request. |
thumbnailVersion | string (int64) | Output only. The thumbnail version for use in thumbnail cache invalidation. |
title | string | The title of this file. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the title is constant. |
trashedDate | string (date-time) | The time that the item was trashed (formatted RFC 3339 timestamp). Only populated for items in shared drives. |
trashingUser | object | Information about a Drive user. (id: User) |
userPermission | object | Output only. The permissions for the authenticated user on this file. (id: Permission) |
version | string (int64) | Output only. A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the requesting user. |
videoMediaMetadata | object | Output only. Metadata about video media. This will only be present for video types. |
webContentLink | string | Output only. A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials. |
webViewLink | string | Output only. A link only available on public folders for viewing their static web assets (HTML, CSS, JS, etc) via Google Drive's Website Hosting. |
writersCanShare | boolean | Whether writers can share the document with other users. Not populated for items in shared drives. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | fileId | acknowledgeAbuse , projection , revisionId , supportsAllDrives , supportsTeamDrives , updateViewedDate , includePermissionsForView , includeLabels | Gets a file's metadata or content by ID. If you provide the URL parameter alt=media , then the response includes the file contents in the response body. Downloading content with alt=media only works if the file is stored in Drive. To download Google Docs, Sheets, and Slides use files.export instead. For more information, see Download & export files. |
list | select | corpora , corpus , driveId , includeItemsFromAllDrives , includeTeamDriveItems , maxResults , orderBy , pageToken , projection , q , spaces , supportsAllDrives , supportsTeamDrives , teamDriveId , includePermissionsForView , includeLabels | Lists the user's files. This method accepts the q parameter, which is a search query combining one or more search terms. For more information, see the Search for files & folders guide. Note: This method returns all files by default, including trashed files. If you don't want trashed files to appear in the list, use the trashed=false query parameter to remove trashed files from the results. | |
insert | insert | convert , enforceSingleParent , ocr , ocrLanguage , pinned , supportsAllDrives , supportsTeamDrives , timedTextLanguage , timedTextTrackName , useContentAsIndexableText , visibility , includePermissionsForView , includeLabels | Inserts a new file. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/* Note: Specify a valid MIME type, rather than the literal */* value. The literal */* is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data. Apps creating shortcuts with files.insert must specify the MIME type application/vnd.google-apps.shortcut . Apps should specify a file extension in the title property when inserting files with the API. For example, an operation to insert a JPEG file should specify something like "title": "cat.jpg" in the metadata. Subsequent GET requests include the read-only fileExtension property populated with the extension originally specified in the title property. When a Google Drive user requests to download a file, or when the file is downloaded through the sync client, Drive builds a full filename (with extension) based on the title. In cases where the extension is missing, Drive attempts to determine the extension based on the file's MIME type. | |
patch | update | fileId | addParents , convert , enforceSingleParent , modifiedDateBehavior , newRevision , ocr , ocrLanguage , pinned , removeParents , setModifiedDate , supportsAllDrives , supportsTeamDrives , timedTextLanguage , timedTextTrackName , updateViewedDate , useContentAsIndexableText , includePermissionsForView , includeLabels | Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might change automatically, such as modifiedDate. This method supports patch semantics. |
update | replace | fileId | addParents , convert , enforceSingleParent , modifiedDateBehavior , newRevision , ocr , ocrLanguage , pinned , removeParents , setModifiedDate , supportsAllDrives , supportsTeamDrives , timedTextLanguage , timedTextTrackName , updateViewedDate , useContentAsIndexableText , includePermissionsForView , includeLabels | Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might be changed automatically, such as modifiedDate . This method supports patch semantics. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/* Note: Specify a valid MIME type, rather than the literal */* value. The literal */* is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data. |
delete | delete | fileId | supportsAllDrives , supportsTeamDrives , enforceSingleParent | Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive, the user must be an organizer on the parent folder. If the target is a folder, all descendants owned by the user are also deleted. |
copy | exec | fileId | convert , enforceSingleParent , ocr , ocrLanguage , pinned , supportsAllDrives , supportsTeamDrives , timedTextLanguage , timedTextTrackName , visibility , includePermissionsForView , includeLabels | Creates a copy of the specified file. |
empty_trash | exec | enforceSingleParent , driveId | Permanently deletes all of the user's trashed files. | |
export | exec | fileId , mimeType | Exports a Google Workspace document to the requested MIME type and returns exported byte content. Note that the exported content is limited to 10MB. | |
generate_ids | exec | maxResults , space , type | Generates a set of file IDs which can be provided in insert or copy requests. | |
modify_labels | exec | fileId | Modifies the set of labels applied to a file. Returns a list of the labels that were added or modified. | |
touch | exec | fileId | supportsAllDrives , supportsTeamDrives , includePermissionsForView , includeLabels | Set the file's updated time to the current server time. |
trash | exec | fileId | supportsAllDrives , supportsTeamDrives , includePermissionsForView , includeLabels | Moves a file to the trash. The currently authenticated user must own the file or be at least a fileOrganizer on the parent for shared drive files. |
untrash | exec | fileId | supportsAllDrives , supportsTeamDrives , includePermissionsForView , includeLabels | Restores a file from the trash. The currently authenticated user must own the file or be at least a fileOrganizer on the parent for shared drive files. |
watch | exec | fileId | supportsAllDrives , supportsTeamDrives , acknowledgeAbuse , includePermissionsForView , revisionId , updateViewedDate , projection , includeLabels | Subscribes to changes to 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.
Name | Datatype | Description |
---|---|---|
fileId | string | |
mimeType | string | |
acknowledgeAbuse | boolean | |
addParents | string | |
convert | boolean | |
corpora | string | |
corpus | string | |
driveId | string | |
enforceSingleParent | boolean | |
includeItemsFromAllDrives | boolean | |
includeLabels | string | |
includePermissionsForView | string | |
includeTeamDriveItems | boolean | |
maxResults | integer (int32) | |
modifiedDateBehavior | string | |
newRevision | boolean | |
ocr | boolean | |
ocrLanguage | string | |
orderBy | string | |
pageToken | string | |
pinned | boolean | |
projection | string | |
q | string | |
removeParents | string | |
revisionId | string | |
setModifiedDate | boolean | |
space | string | |
spaces | string | |
supportsAllDrives | boolean | |
supportsTeamDrives | boolean | |
teamDriveId | string | |
timedTextLanguage | string | |
timedTextTrackName | string | |
type | string | |
updateViewedDate | boolean | |
useContentAsIndexableText | boolean | |
visibility | string |
SELECT
examples
- get
- list
Gets a file's metadata or content by ID. If you provide the URL parameter alt=media
, then the response includes the file contents in the response body. Downloading content with alt=media
only works if the file is stored in Drive. To download Google Docs, Sheets, and Slides use files.export
instead. For more information, see Download & export files.
SELECT
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare
FROM googleworkspace.drivev2.files
WHERE fileId = '{{ fileId }}' -- required
AND acknowledgeAbuse = '{{ acknowledgeAbuse }}'
AND projection = '{{ projection }}'
AND revisionId = '{{ revisionId }}'
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND updateViewedDate = '{{ updateViewedDate }}'
AND includePermissionsForView = '{{ includePermissionsForView }}'
AND includeLabels = '{{ includeLabels }}'
;
Lists the user's files. This method accepts the q
parameter, which is a search query combining one or more search terms. For more information, see the Search for files & folders guide. Note: This method returns all files by default, including trashed files. If you don't want trashed files to appear in the list, use the trashed=false
query parameter to remove trashed files from the results.
SELECT
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare
FROM googleworkspace.drivev2.files
WHERE corpora = '{{ corpora }}'
AND corpus = '{{ corpus }}'
AND driveId = '{{ driveId }}'
AND includeItemsFromAllDrives = '{{ includeItemsFromAllDrives }}'
AND includeTeamDriveItems = '{{ includeTeamDriveItems }}'
AND maxResults = '{{ maxResults }}'
AND orderBy = '{{ orderBy }}'
AND pageToken = '{{ pageToken }}'
AND projection = '{{ projection }}'
AND q = '{{ q }}'
AND spaces = '{{ spaces }}'
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND teamDriveId = '{{ teamDriveId }}'
AND includePermissionsForView = '{{ includePermissionsForView }}'
AND includeLabels = '{{ includeLabels }}'
;
INSERT
examples
- insert
- Manifest
Inserts a new file. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/*
Note: Specify a valid MIME type, rather than the literal */*
value. The literal */*
is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data. Apps creating shortcuts with files.insert
must specify the MIME type application/vnd.google-apps.shortcut
. Apps should specify a file extension in the title
property when inserting files with the API. For example, an operation to insert a JPEG file should specify something like "title": "cat.jpg"
in the metadata. Subsequent GET
requests include the read-only fileExtension
property populated with the extension originally specified in the title
property. When a Google Drive user requests to download a file, or when the file is downloaded through the sync client, Drive builds a full filename (with extension) based on the title. In cases where the extension is missing, Drive attempts to determine the extension based on the file's MIME type.
INSERT INTO googleworkspace.drivev2.files (
data__kind,
data__userPermission,
data__fileExtension,
data__md5Checksum,
data__selfLink,
data__ownerNames,
data__lastModifyingUserName,
data__editable,
data__writersCanShare,
data__downloadUrl,
data__mimeType,
data__driveId,
data__parents,
data__thumbnailLink,
data__appDataContents,
data__webViewLink,
data__iconLink,
data__shared,
data__lastModifyingUser,
data__owners,
data__openWithLinks,
data__defaultOpenWithLink,
data__headRevisionId,
data__properties,
data__copyable,
data__etag,
data__sharingUser,
data__alternateLink,
data__embedLink,
data__webContentLink,
data__fileSize,
data__copyRequiresWriterPermission,
data__permissions,
data__hasThumbnail,
data__spaces,
data__folderColorRgb,
data__id,
data__title,
data__description,
data__labels,
data__explicitlyTrashed,
data__createdDate,
data__modifiedDate,
data__modifiedByMeDate,
data__lastViewedByMeDate,
data__markedViewedByMeDate,
data__sharedWithMeDate,
data__quotaBytesUsed,
data__version,
data__indexableText,
data__originalFilename,
data__ownedByMe,
data__canComment,
data__shareable,
data__fullFileExtension,
data__isAppAuthorized,
data__teamDriveId,
data__capabilities,
data__hasAugmentedPermissions,
data__trashingUser,
data__canReadRevisions,
data__thumbnailVersion,
data__trashedDate,
data__permissionIds,
data__thumbnail,
data__imageMediaMetadata,
data__videoMediaMetadata,
data__shortcutDetails,
data__contentRestrictions,
data__resourceKey,
data__linkShareMetadata,
data__labelInfo,
data__sha1Checksum,
data__sha256Checksum,
data__inheritedPermissionsDisabled,
convert,
enforceSingleParent,
ocr,
ocrLanguage,
pinned,
supportsAllDrives,
supportsTeamDrives,
timedTextLanguage,
timedTextTrackName,
useContentAsIndexableText,
visibility,
includePermissionsForView,
includeLabels
)
SELECT
'{{ kind }}',
'{{ userPermission }}',
'{{ fileExtension }}',
'{{ md5Checksum }}',
'{{ selfLink }}',
'{{ ownerNames }}',
'{{ lastModifyingUserName }}',
{{ editable }},
{{ writersCanShare }},
'{{ downloadUrl }}',
'{{ mimeType }}',
'{{ driveId }}',
'{{ parents }}',
'{{ thumbnailLink }}',
{{ appDataContents }},
'{{ webViewLink }}',
'{{ iconLink }}',
{{ shared }},
'{{ lastModifyingUser }}',
'{{ owners }}',
'{{ openWithLinks }}',
'{{ defaultOpenWithLink }}',
'{{ headRevisionId }}',
'{{ properties }}',
{{ copyable }},
'{{ etag }}',
'{{ sharingUser }}',
'{{ alternateLink }}',
'{{ embedLink }}',
'{{ webContentLink }}',
'{{ fileSize }}',
{{ copyRequiresWriterPermission }},
'{{ permissions }}',
{{ hasThumbnail }},
'{{ spaces }}',
'{{ folderColorRgb }}',
'{{ id }}',
'{{ title }}',
'{{ description }}',
'{{ labels }}',
{{ explicitlyTrashed }},
'{{ createdDate }}',
'{{ modifiedDate }}',
'{{ modifiedByMeDate }}',
'{{ lastViewedByMeDate }}',
'{{ markedViewedByMeDate }}',
'{{ sharedWithMeDate }}',
'{{ quotaBytesUsed }}',
'{{ version }}',
'{{ indexableText }}',
'{{ originalFilename }}',
{{ ownedByMe }},
{{ canComment }},
{{ shareable }},
'{{ fullFileExtension }}',
{{ isAppAuthorized }},
'{{ teamDriveId }}',
'{{ capabilities }}',
{{ hasAugmentedPermissions }},
'{{ trashingUser }}',
{{ canReadRevisions }},
'{{ thumbnailVersion }}',
'{{ trashedDate }}',
'{{ permissionIds }}',
'{{ thumbnail }}',
'{{ imageMediaMetadata }}',
'{{ videoMediaMetadata }}',
'{{ shortcutDetails }}',
'{{ contentRestrictions }}',
'{{ resourceKey }}',
'{{ linkShareMetadata }}',
'{{ labelInfo }}',
'{{ sha1Checksum }}',
'{{ sha256Checksum }}',
{{ inheritedPermissionsDisabled }},
'{{ convert }}',
'{{ enforceSingleParent }}',
'{{ ocr }}',
'{{ ocrLanguage }}',
'{{ pinned }}',
'{{ supportsAllDrives }}',
'{{ supportsTeamDrives }}',
'{{ timedTextLanguage }}',
'{{ timedTextTrackName }}',
'{{ useContentAsIndexableText }}',
'{{ visibility }}',
'{{ includePermissionsForView }}',
'{{ includeLabels }}'
RETURNING
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare
;
# Description fields are for documentation purposes
- name: files
props:
- name: kind
value: string
description: >
Output only. The type of file. This is always `drive#file`.
default: drive#file
- name: userPermission
value: object
description: >
Output only. The permissions for the authenticated user on this file.
- name: fileExtension
value: string
description: >
Output only. The final component of `fullFileExtension` with trailing text that does not appear to be part of the extension removed. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
- name: md5Checksum
value: string
description: >
Output only. An MD5 checksum for the content of this file. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
- name: selfLink
value: string
description: >
Output only. A link back to this file.
- name: ownerNames
value: array
description: >
Output only. Name(s) of the owner(s) of this file. Not populated for items in shared drives.
- name: lastModifyingUserName
value: string
description: >
Output only. Name of the last user to modify this file.
- name: editable
value: boolean
description: >
Output only. Deprecated: Use `capabilities/canEdit` instead.
- name: writersCanShare
value: boolean
description: >
Whether writers can share the document with other users. Not populated for items in shared drives.
- name: downloadUrl
value: string
description: >
Output only. Short lived download URL for the file. This field is only populated for files with content stored in Google Drive; it is not populated for Google Docs or shortcut files.
- name: mimeType
value: string
description: >
The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type.
- name: driveId
value: string
description: >
Output only. ID of the shared drive the file resides in. Only populated for items in shared drives.
- name: parents
value: array
description: >
The ID of the parent folder containing the file. A file can only have one parent folder; specifying multiple parents isn't supported. If not specified as part of an insert request, the file is placed directly in the user's My Drive folder. If not specified as part of a copy request, the file inherits any discoverable parent of the source file. Update requests must use the `addParents` and `removeParents` parameters to modify the parents list.
- name: thumbnailLink
value: string
description: >
Output only. A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Not intended for direct usage on web applications due to [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), consider using a proxy server. Only populated when the requesting app can access the file's content. If the file isn't shared publicly, the URL returned in `Files.thumbnailLink` must be fetched using a credentialed request.
- name: appDataContents
value: boolean
description: >
Output only. Whether this file is in the Application Data folder.
- name: webViewLink
value: string
description: >
Output only. A link only available on public folders for viewing their static web assets (HTML, CSS, JS, etc) via Google Drive's Website Hosting.
- name: iconLink
value: string
description: >
Output only. A link to the file's icon.
- name: shared
value: boolean
description: >
Output only. Whether the file has been shared. Not populated for items in shared drives.
- name: lastModifyingUser
value: object
description: >
Output only. The last user to modify this file. This field is only populated when the last modification was performed by a signed-in user.
- name: owners
value: array
description: >
Output only. The owner of this file. Only certain legacy files may have more than one owner. This field isn't populated for items in shared drives.
- name: openWithLinks
value: object
description: >
Output only. A map of the id of each of the user's apps to a link to open this file with that app. Only populated when the drive.apps.readonly scope is used.
- name: defaultOpenWithLink
value: string
description: >
Output only. A link to open this file with the user's default app for this file. Only populated when the drive.apps.readonly scope is used.
- name: headRevisionId
value: string
description: >
Output only. The ID of the file's head revision. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
- name: properties
value: array
description: >
The list of properties.
- name: copyable
value: boolean
description: >
Output only. Deprecated: Use `capabilities/canCopy` instead.
- name: etag
value: string
description: >
Output only. ETag of the file.
- name: sharingUser
value: object
description: >
Information about a Drive user.
- name: alternateLink
value: string
description: >
Output only. A link for opening the file in a relevant Google editor or viewer.
- name: embedLink
value: string
description: >
Output only. A link for embedding the file.
- name: webContentLink
value: string
description: >
Output only. A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials.
- name: fileSize
value: string
description: >
Output only. Size in bytes of blobs and first party editor files. Won't be populated for files that have no size, like shortcuts and folders.
- name: copyRequiresWriterPermission
value: boolean
description: >
Whether the options to copy, print, or download this file, should be disabled for readers and commenters.
- name: permissions
value: array
description: >
Output only. The list of permissions for users with access to this file. Not populated for items in shared drives.
- name: hasThumbnail
value: boolean
description: >
Output only. Whether this file has a thumbnail. This does not indicate whether the requesting app has access to the thumbnail. To check access, look for the presence of the thumbnailLink field.
- name: spaces
value: array
description: >
Output only. The list of spaces which contain the file. Supported values are `drive`, `appDataFolder` and `photos`.
- name: folderColorRgb
value: string
description: >
Folder color as an RGB hex string if the file is a folder or a shortcut to a folder. The list of supported colors is available in the folderColorPalette field of the About resource. If an unsupported color is specified, it will be changed to the closest color in the palette.
- name: id
value: string
description: >
The ID of the file.
- name: title
value: string
description: >
The title of this file. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the title is constant.
- name: description
value: string
description: >
A short description of the file.
- name: labels
value: object
description: >
A group of labels for the file.
- name: explicitlyTrashed
value: boolean
description: >
Output only. Whether this file has been explicitly trashed, as opposed to recursively trashed.
- name: createdDate
value: string
description: >
Create time for this file (formatted RFC 3339 timestamp).
- name: modifiedDate
value: string
description: >
Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set.
- name: modifiedByMeDate
value: string
description: >
Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date.
- name: lastViewedByMeDate
value: string
description: >
Last time this file was viewed by the user (formatted RFC 3339 timestamp).
- name: markedViewedByMeDate
value: string
description: >
Deprecated.
- name: sharedWithMeDate
value: string
description: >
Time at which this file was shared with the user (formatted RFC 3339 timestamp).
- name: quotaBytesUsed
value: string
description: >
Output only. The number of quota bytes used by this file.
- name: version
value: string
description: >
Output only. A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the requesting user.
- name: indexableText
value: object
description: >
Indexable text attributes for the file (can only be written)
- name: originalFilename
value: string
description: >
The original filename of the uploaded content if available, or else the original value of the `title` field. This is only available for files with binary content in Google Drive.
- name: ownedByMe
value: boolean
description: >
Output only. Whether the file is owned by the current user. Not populated for items in shared drives.
- name: canComment
value: boolean
description: >
Output only. Deprecated: Use `capabilities/canComment` instead.
- name: shareable
value: boolean
description: >
Output only. Deprecated: Use `capabilities/canShare` instead.
- name: fullFileExtension
value: string
description: >
Output only. The full file extension; extracted from the title. May contain multiple concatenated extensions, such as "tar.gz". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
- name: isAppAuthorized
value: boolean
description: >
Output only. Whether the file was created or opened by the requesting app.
- name: teamDriveId
value: string
description: >
Output only. Deprecated: Use `driveId` instead.
- name: capabilities
value: object
description: >
Output only. Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take.
- name: hasAugmentedPermissions
value: boolean
description: >
Output only. Whether there are permissions directly on this file. This field is only populated for items in shared drives.
- name: trashingUser
value: object
description: >
Information about a Drive user.
- name: canReadRevisions
value: boolean
description: >
Output only. Deprecated: Use `capabilities/canReadRevisions` instead.
- name: thumbnailVersion
value: string
description: >
Output only. The thumbnail version for use in thumbnail cache invalidation.
- name: trashedDate
value: string
description: >
The time that the item was trashed (formatted RFC 3339 timestamp). Only populated for items in shared drives.
- name: permissionIds
value: array
description: >
Output only. List of permission IDs for users with access to this file.
- name: thumbnail
value: object
description: >
A thumbnail for the file. This will only be used if a standard thumbnail cannot be generated.
- name: imageMediaMetadata
value: object
description: >
Output only. Metadata about image media. This will only be present for image types, and its contents will depend on what can be parsed from the image content.
- name: videoMediaMetadata
value: object
description: >
Output only. Metadata about video media. This will only be present for video types.
- name: shortcutDetails
value: object
description: >
Shortcut file details. Only populated for shortcut files, which have the mimeType field set to `application/vnd.google-apps.shortcut`. Can only be set on `files.insert` requests.
- name: contentRestrictions
value: array
description: >
Restrictions for accessing the content of the file. Only populated if such a restriction exists.
- name: resourceKey
value: string
description: >
Output only. A key needed to access the item via a shared link.
- name: linkShareMetadata
value: object
description: >
Contains details about the link URLs that clients are using to refer to this item.
- name: labelInfo
value: object
description: >
Output only. An overview of the labels on the file.
- name: sha1Checksum
value: string
description: >
Output only. The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
- name: sha256Checksum
value: string
description: >
Output only. The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
- name: inheritedPermissionsDisabled
value: boolean
description: >
Whether this file has inherited permissions disabled. Inherited permissions are enabled by default.
- name: convert
value: boolean
- name: enforceSingleParent
value: boolean
- name: ocr
value: boolean
- name: ocrLanguage
value: string
- name: pinned
value: boolean
- name: supportsAllDrives
value: boolean
- name: supportsTeamDrives
value: boolean
- name: timedTextLanguage
value: string
- name: timedTextTrackName
value: string
- name: useContentAsIndexableText
value: boolean
- name: visibility
value: string
- name: includePermissionsForView
value: string
- name: includeLabels
value: string
UPDATE
examples
- patch
Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might change automatically, such as modifiedDate. This method supports patch semantics.
UPDATE googleworkspace.drivev2.files
SET
data__kind = '{{ kind }}',
data__userPermission = '{{ userPermission }}',
data__fileExtension = '{{ fileExtension }}',
data__md5Checksum = '{{ md5Checksum }}',
data__selfLink = '{{ selfLink }}',
data__ownerNames = '{{ ownerNames }}',
data__lastModifyingUserName = '{{ lastModifyingUserName }}',
data__editable = {{ editable }},
data__writersCanShare = {{ writersCanShare }},
data__downloadUrl = '{{ downloadUrl }}',
data__mimeType = '{{ mimeType }}',
data__driveId = '{{ driveId }}',
data__parents = '{{ parents }}',
data__thumbnailLink = '{{ thumbnailLink }}',
data__appDataContents = {{ appDataContents }},
data__webViewLink = '{{ webViewLink }}',
data__iconLink = '{{ iconLink }}',
data__shared = {{ shared }},
data__lastModifyingUser = '{{ lastModifyingUser }}',
data__owners = '{{ owners }}',
data__openWithLinks = '{{ openWithLinks }}',
data__defaultOpenWithLink = '{{ defaultOpenWithLink }}',
data__headRevisionId = '{{ headRevisionId }}',
data__properties = '{{ properties }}',
data__copyable = {{ copyable }},
data__etag = '{{ etag }}',
data__sharingUser = '{{ sharingUser }}',
data__alternateLink = '{{ alternateLink }}',
data__embedLink = '{{ embedLink }}',
data__webContentLink = '{{ webContentLink }}',
data__fileSize = '{{ fileSize }}',
data__copyRequiresWriterPermission = {{ copyRequiresWriterPermission }},
data__permissions = '{{ permissions }}',
data__hasThumbnail = {{ hasThumbnail }},
data__spaces = '{{ spaces }}',
data__folderColorRgb = '{{ folderColorRgb }}',
data__id = '{{ id }}',
data__title = '{{ title }}',
data__description = '{{ description }}',
data__labels = '{{ labels }}',
data__explicitlyTrashed = {{ explicitlyTrashed }},
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__modifiedByMeDate = '{{ modifiedByMeDate }}',
data__lastViewedByMeDate = '{{ lastViewedByMeDate }}',
data__markedViewedByMeDate = '{{ markedViewedByMeDate }}',
data__sharedWithMeDate = '{{ sharedWithMeDate }}',
data__quotaBytesUsed = '{{ quotaBytesUsed }}',
data__version = '{{ version }}',
data__indexableText = '{{ indexableText }}',
data__originalFilename = '{{ originalFilename }}',
data__ownedByMe = {{ ownedByMe }},
data__canComment = {{ canComment }},
data__shareable = {{ shareable }},
data__fullFileExtension = '{{ fullFileExtension }}',
data__isAppAuthorized = {{ isAppAuthorized }},
data__teamDriveId = '{{ teamDriveId }}',
data__capabilities = '{{ capabilities }}',
data__hasAugmentedPermissions = {{ hasAugmentedPermissions }},
data__trashingUser = '{{ trashingUser }}',
data__canReadRevisions = {{ canReadRevisions }},
data__thumbnailVersion = '{{ thumbnailVersion }}',
data__trashedDate = '{{ trashedDate }}',
data__permissionIds = '{{ permissionIds }}',
data__thumbnail = '{{ thumbnail }}',
data__imageMediaMetadata = '{{ imageMediaMetadata }}',
data__videoMediaMetadata = '{{ videoMediaMetadata }}',
data__shortcutDetails = '{{ shortcutDetails }}',
data__contentRestrictions = '{{ contentRestrictions }}',
data__resourceKey = '{{ resourceKey }}',
data__linkShareMetadata = '{{ linkShareMetadata }}',
data__labelInfo = '{{ labelInfo }}',
data__sha1Checksum = '{{ sha1Checksum }}',
data__sha256Checksum = '{{ sha256Checksum }}',
data__inheritedPermissionsDisabled = {{ inheritedPermissionsDisabled }}
WHERE
fileId = '{{ fileId }}' --required
AND addParents = '{{ addParents}}'
AND convert = {{ convert}}
AND enforceSingleParent = {{ enforceSingleParent}}
AND modifiedDateBehavior = '{{ modifiedDateBehavior}}'
AND newRevision = {{ newRevision}}
AND ocr = {{ ocr}}
AND ocrLanguage = '{{ ocrLanguage}}'
AND pinned = {{ pinned}}
AND removeParents = '{{ removeParents}}'
AND setModifiedDate = {{ setModifiedDate}}
AND supportsAllDrives = {{ supportsAllDrives}}
AND supportsTeamDrives = {{ supportsTeamDrives}}
AND timedTextLanguage = '{{ timedTextLanguage}}'
AND timedTextTrackName = '{{ timedTextTrackName}}'
AND updateViewedDate = {{ updateViewedDate}}
AND useContentAsIndexableText = {{ useContentAsIndexableText}}
AND includePermissionsForView = '{{ includePermissionsForView}}'
AND includeLabels = '{{ includeLabels}}'
RETURNING
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare;
REPLACE
examples
- update
Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might be changed automatically, such as modifiedDate
. This method supports patch semantics. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/*
Note: Specify a valid MIME type, rather than the literal */*
value. The literal */*
is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data.
REPLACE googleworkspace.drivev2.files
SET
data__kind = '{{ kind }}',
data__userPermission = '{{ userPermission }}',
data__fileExtension = '{{ fileExtension }}',
data__md5Checksum = '{{ md5Checksum }}',
data__selfLink = '{{ selfLink }}',
data__ownerNames = '{{ ownerNames }}',
data__lastModifyingUserName = '{{ lastModifyingUserName }}',
data__editable = {{ editable }},
data__writersCanShare = {{ writersCanShare }},
data__downloadUrl = '{{ downloadUrl }}',
data__mimeType = '{{ mimeType }}',
data__driveId = '{{ driveId }}',
data__parents = '{{ parents }}',
data__thumbnailLink = '{{ thumbnailLink }}',
data__appDataContents = {{ appDataContents }},
data__webViewLink = '{{ webViewLink }}',
data__iconLink = '{{ iconLink }}',
data__shared = {{ shared }},
data__lastModifyingUser = '{{ lastModifyingUser }}',
data__owners = '{{ owners }}',
data__openWithLinks = '{{ openWithLinks }}',
data__defaultOpenWithLink = '{{ defaultOpenWithLink }}',
data__headRevisionId = '{{ headRevisionId }}',
data__properties = '{{ properties }}',
data__copyable = {{ copyable }},
data__etag = '{{ etag }}',
data__sharingUser = '{{ sharingUser }}',
data__alternateLink = '{{ alternateLink }}',
data__embedLink = '{{ embedLink }}',
data__webContentLink = '{{ webContentLink }}',
data__fileSize = '{{ fileSize }}',
data__copyRequiresWriterPermission = {{ copyRequiresWriterPermission }},
data__permissions = '{{ permissions }}',
data__hasThumbnail = {{ hasThumbnail }},
data__spaces = '{{ spaces }}',
data__folderColorRgb = '{{ folderColorRgb }}',
data__id = '{{ id }}',
data__title = '{{ title }}',
data__description = '{{ description }}',
data__labels = '{{ labels }}',
data__explicitlyTrashed = {{ explicitlyTrashed }},
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__modifiedByMeDate = '{{ modifiedByMeDate }}',
data__lastViewedByMeDate = '{{ lastViewedByMeDate }}',
data__markedViewedByMeDate = '{{ markedViewedByMeDate }}',
data__sharedWithMeDate = '{{ sharedWithMeDate }}',
data__quotaBytesUsed = '{{ quotaBytesUsed }}',
data__version = '{{ version }}',
data__indexableText = '{{ indexableText }}',
data__originalFilename = '{{ originalFilename }}',
data__ownedByMe = {{ ownedByMe }},
data__canComment = {{ canComment }},
data__shareable = {{ shareable }},
data__fullFileExtension = '{{ fullFileExtension }}',
data__isAppAuthorized = {{ isAppAuthorized }},
data__teamDriveId = '{{ teamDriveId }}',
data__capabilities = '{{ capabilities }}',
data__hasAugmentedPermissions = {{ hasAugmentedPermissions }},
data__trashingUser = '{{ trashingUser }}',
data__canReadRevisions = {{ canReadRevisions }},
data__thumbnailVersion = '{{ thumbnailVersion }}',
data__trashedDate = '{{ trashedDate }}',
data__permissionIds = '{{ permissionIds }}',
data__thumbnail = '{{ thumbnail }}',
data__imageMediaMetadata = '{{ imageMediaMetadata }}',
data__videoMediaMetadata = '{{ videoMediaMetadata }}',
data__shortcutDetails = '{{ shortcutDetails }}',
data__contentRestrictions = '{{ contentRestrictions }}',
data__resourceKey = '{{ resourceKey }}',
data__linkShareMetadata = '{{ linkShareMetadata }}',
data__labelInfo = '{{ labelInfo }}',
data__sha1Checksum = '{{ sha1Checksum }}',
data__sha256Checksum = '{{ sha256Checksum }}',
data__inheritedPermissionsDisabled = {{ inheritedPermissionsDisabled }}
WHERE
fileId = '{{ fileId }}' --required
AND addParents = '{{ addParents}}'
AND convert = {{ convert}}
AND enforceSingleParent = {{ enforceSingleParent}}
AND modifiedDateBehavior = '{{ modifiedDateBehavior}}'
AND newRevision = {{ newRevision}}
AND ocr = {{ ocr}}
AND ocrLanguage = '{{ ocrLanguage}}'
AND pinned = {{ pinned}}
AND removeParents = '{{ removeParents}}'
AND setModifiedDate = {{ setModifiedDate}}
AND supportsAllDrives = {{ supportsAllDrives}}
AND supportsTeamDrives = {{ supportsTeamDrives}}
AND timedTextLanguage = '{{ timedTextLanguage}}'
AND timedTextTrackName = '{{ timedTextTrackName}}'
AND updateViewedDate = {{ updateViewedDate}}
AND useContentAsIndexableText = {{ useContentAsIndexableText}}
AND includePermissionsForView = '{{ includePermissionsForView}}'
AND includeLabels = '{{ includeLabels}}'
RETURNING
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare;
DELETE
examples
- delete
Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive, the user must be an organizer
on the parent folder. If the target is a folder, all descendants owned by the user are also deleted.
DELETE FROM googleworkspace.drivev2.files
WHERE fileId = '{{ fileId }}' --required
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND enforceSingleParent = '{{ enforceSingleParent }}'
;
Lifecycle Methods
- copy
- empty_trash
- export
- generate_ids
- modify_labels
- touch
- trash
- untrash
- watch
Creates a copy of the specified file.
EXEC googleworkspace.drivev2.files.copy
@fileId='{{ fileId }}' --required,
@convert={{ convert }},
@enforceSingleParent={{ enforceSingleParent }},
@ocr={{ ocr }},
@ocrLanguage='{{ ocrLanguage }}',
@pinned={{ pinned }},
@supportsAllDrives={{ supportsAllDrives }},
@supportsTeamDrives={{ supportsTeamDrives }},
@timedTextLanguage='{{ timedTextLanguage }}',
@timedTextTrackName='{{ timedTextTrackName }}',
@visibility='{{ visibility }}',
@includePermissionsForView='{{ includePermissionsForView }}',
@includeLabels='{{ includeLabels }}'
@@json=
'{
"kind": "{{ kind }}",
"userPermission": "{{ userPermission }}",
"fileExtension": "{{ fileExtension }}",
"md5Checksum": "{{ md5Checksum }}",
"selfLink": "{{ selfLink }}",
"ownerNames": "{{ ownerNames }}",
"lastModifyingUserName": "{{ lastModifyingUserName }}",
"editable": {{ editable }},
"writersCanShare": {{ writersCanShare }},
"downloadUrl": "{{ downloadUrl }}",
"mimeType": "{{ mimeType }}",
"driveId": "{{ driveId }}",
"parents": "{{ parents }}",
"thumbnailLink": "{{ thumbnailLink }}",
"appDataContents": {{ appDataContents }},
"webViewLink": "{{ webViewLink }}",
"iconLink": "{{ iconLink }}",
"shared": {{ shared }},
"lastModifyingUser": "{{ lastModifyingUser }}",
"owners": "{{ owners }}",
"openWithLinks": "{{ openWithLinks }}",
"defaultOpenWithLink": "{{ defaultOpenWithLink }}",
"headRevisionId": "{{ headRevisionId }}",
"properties": "{{ properties }}",
"copyable": {{ copyable }},
"etag": "{{ etag }}",
"sharingUser": "{{ sharingUser }}",
"alternateLink": "{{ alternateLink }}",
"embedLink": "{{ embedLink }}",
"webContentLink": "{{ webContentLink }}",
"fileSize": "{{ fileSize }}",
"copyRequiresWriterPermission": {{ copyRequiresWriterPermission }},
"permissions": "{{ permissions }}",
"hasThumbnail": {{ hasThumbnail }},
"spaces": "{{ spaces }}",
"folderColorRgb": "{{ folderColorRgb }}",
"id": "{{ id }}",
"title": "{{ title }}",
"description": "{{ description }}",
"labels": "{{ labels }}",
"explicitlyTrashed": {{ explicitlyTrashed }},
"createdDate": "{{ createdDate }}",
"modifiedDate": "{{ modifiedDate }}",
"modifiedByMeDate": "{{ modifiedByMeDate }}",
"lastViewedByMeDate": "{{ lastViewedByMeDate }}",
"markedViewedByMeDate": "{{ markedViewedByMeDate }}",
"sharedWithMeDate": "{{ sharedWithMeDate }}",
"quotaBytesUsed": "{{ quotaBytesUsed }}",
"version": "{{ version }}",
"indexableText": "{{ indexableText }}",
"originalFilename": "{{ originalFilename }}",
"ownedByMe": {{ ownedByMe }},
"canComment": {{ canComment }},
"shareable": {{ shareable }},
"fullFileExtension": "{{ fullFileExtension }}",
"isAppAuthorized": {{ isAppAuthorized }},
"teamDriveId": "{{ teamDriveId }}",
"capabilities": "{{ capabilities }}",
"hasAugmentedPermissions": {{ hasAugmentedPermissions }},
"trashingUser": "{{ trashingUser }}",
"canReadRevisions": {{ canReadRevisions }},
"thumbnailVersion": "{{ thumbnailVersion }}",
"trashedDate": "{{ trashedDate }}",
"permissionIds": "{{ permissionIds }}",
"thumbnail": "{{ thumbnail }}",
"imageMediaMetadata": "{{ imageMediaMetadata }}",
"videoMediaMetadata": "{{ videoMediaMetadata }}",
"shortcutDetails": "{{ shortcutDetails }}",
"contentRestrictions": "{{ contentRestrictions }}",
"resourceKey": "{{ resourceKey }}",
"linkShareMetadata": "{{ linkShareMetadata }}",
"labelInfo": "{{ labelInfo }}",
"sha1Checksum": "{{ sha1Checksum }}",
"sha256Checksum": "{{ sha256Checksum }}",
"inheritedPermissionsDisabled": {{ inheritedPermissionsDisabled }}
}'
;
Permanently deletes all of the user's trashed files.
EXEC googleworkspace.drivev2.files.empty_trash
@enforceSingleParent={{ enforceSingleParent }},
@driveId='{{ driveId }}'
;
Exports a Google Workspace document to the requested MIME type and returns exported byte content. Note that the exported content is limited to 10MB.
EXEC googleworkspace.drivev2.files.export
@fileId='{{ fileId }}' --required,
@mimeType='{{ mimeType }}' --required
;
Generates a set of file IDs which can be provided in insert or copy requests.
EXEC googleworkspace.drivev2.files.generate_ids
@maxResults='{{ maxResults }}',
@space='{{ space }}',
@type='{{ type }}'
;
Modifies the set of labels applied to a file. Returns a list of the labels that were added or modified.
EXEC googleworkspace.drivev2.files.modify_labels
@fileId='{{ fileId }}' --required
@@json=
'{
"labelModifications": "{{ labelModifications }}",
"kind": "{{ kind }}"
}'
;
Set the file's updated time to the current server time.
EXEC googleworkspace.drivev2.files.touch
@fileId='{{ fileId }}' --required,
@supportsAllDrives={{ supportsAllDrives }},
@supportsTeamDrives={{ supportsTeamDrives }},
@includePermissionsForView='{{ includePermissionsForView }}',
@includeLabels='{{ includeLabels }}'
;
Moves a file to the trash. The currently authenticated user must own the file or be at least a fileOrganizer
on the parent for shared drive files.
EXEC googleworkspace.drivev2.files.trash
@fileId='{{ fileId }}' --required,
@supportsAllDrives={{ supportsAllDrives }},
@supportsTeamDrives={{ supportsTeamDrives }},
@includePermissionsForView='{{ includePermissionsForView }}',
@includeLabels='{{ includeLabels }}'
;
Restores a file from the trash. The currently authenticated user must own the file or be at least a fileOrganizer
on the parent for shared drive files.
EXEC googleworkspace.drivev2.files.untrash
@fileId='{{ fileId }}' --required,
@supportsAllDrives={{ supportsAllDrives }},
@supportsTeamDrives={{ supportsTeamDrives }},
@includePermissionsForView='{{ includePermissionsForView }}',
@includeLabels='{{ includeLabels }}'
;
Subscribes to changes to a file.
EXEC googleworkspace.drivev2.files.watch
@fileId='{{ fileId }}' --required,
@supportsAllDrives={{ supportsAllDrives }},
@supportsTeamDrives={{ supportsTeamDrives }},
@acknowledgeAbuse={{ acknowledgeAbuse }},
@includePermissionsForView='{{ includePermissionsForView }}',
@revisionId='{{ revisionId }}',
@updateViewedDate={{ updateViewedDate }},
@projection='{{ projection }}',
@includeLabels='{{ includeLabels }}'
@@json=
'{
"payload": {{ payload }},
"id": "{{ id }}",
"resourceId": "{{ resourceId }}",
"resourceUri": "{{ resourceUri }}",
"token": "{{ token }}",
"expiration": "{{ expiration }}",
"type": "{{ type }}",
"address": "{{ address }}",
"params": "{{ params }}",
"kind": "{{ kind }}"
}'
;