Cmdlets for Google Drive

Build 24.0.9060

Files

Create, update, delete, and query the files and folders contained in a user's Google Drive.

Select

The Files table supports only a subset of columns for filtering. Below is a table containing those columns with their supported operations. All filters can be connected with 'OR' or 'AND' operators.

ColumnSupported Operators
Namecontains, =, !=
MIMETypecontains, =, !=
ModifiedTime<=, <, =, !=, >, >=
Trashed=, !=
Starred=, !=
ParentIdsin
OwnerEmailin

The contains operator only performs prefix matching for a name. For example, the name "HelloWorld" would match for name contains 'Hello' but not name contains 'World'.

SELECT * FROM [Files] WHERE ModifiedTime > '2017-01-01' OR CONTAINS(Name, 'CData')

SELECT * FROM [Files] WHERE OwnerEmail IN ('[email protected]') AND Starred = true

SELECT * FROM [Files] WHERE Starred = true

SELECT * FROM [Files] WHERE DriveId = '0ACkq0ZiV0yJCUk9PVA'
Note: You must set the connection property SupportsAllDrives to 'true', in order to query from a specific Drive.

Insert

You must specify values at least for Name and one of LocalFile or FileData.

INSERT INTO Files (Name, LocalFile) VALUES ('MyFile', 'C:\\\\file.txt')

Update

Id is required for updating a File.

UPDATE Files SET Name = 'UpdatedName' WHERE Id = '19YFv8wmvKixCYaJJAeE8jN3ROt7x1ZicvXwflswVOrw'

Also the content of the file can be updated. Note that this will replace the actual content.

UPDATE Files SET LocalFile = 'C:\\\\file.txt' WHERE Id = '19YFv8wmvKixCYaJJAeE8jN3ROt7x1ZicvXwflswVOrw'

Delete

To delete a File, the Id is required.

DELETE FROM [Files] WHERE Id = '1Dx6GTyhgTmTjtoy8GuG0n0qaOsKyhwrOG6MG8A2QQYA'

Columns

Name Type ReadOnly Description
Id [KEY] String True

The ID of the file.

Name String False

The name of the file. This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of Team Drives, My Drive root folder, and Application Data folder the name is constant.

DriveId String True

The Id of the Drive.

Description String False

A short description of the file or folder.

Extension String True

The extension of the file.

MIMEType String False

The MIME type of the file.

CreatedTime Datetime True

The creation date of the file or folder.

ModifiedTime Datetime True

The last modified date of the file or folder.

Size Long True

The size of the file in bytes.

OwnerName String True

The name of the resource's owner.

OwnerEmail String True

The email of the resource's owner.

Folder Boolean True

This field shows whether or not the resource is a folder.

Starred Boolean False

This field sets whether or not the resource is starred.

Trashed Boolean True

This field sets whether or not the resource has been moved to the trash.

Viewed Boolean True

This field sets whether or not the resource has been viewed by the current user.

ParentIds String True

A comma-separated list of parent folder Ids.

ChildIds String True

A semicolon-separated list of child resource Ids.

ChildLinks String True

A semicolon-separated list of child resource links.

Query String True

This field accepts a valid Google Drive SDK query, which overrides conditionals in the WHERE clause.

LocalFile String False

The local file path, including file name, of the file to be uploaded. Required when FileData is not specified. Used only for inserting and updating a file.

FileData String False

If the LocalFile input is empty, file data will be output in the format specified by the Encoding input. Used only for inserting and updating a file.

Encoding String False

The FileData input encoding type. Used only for inserting and updating a file.

The allowed values are NONE, BASE64.

The default value is BASE64.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060