Activities
Query data on activities performed in your files, folders, and drives.
Select
The https://www.googleapis.com/auth/drive.activity.readonly scope is required to use this view. CData's embedded OAuth application does not support this scope. You must create a custom OAuth application and enable the Google Drive Activity API from the Library page (see Creating a Custom OAuth App).To read activity data with this view, either the ItemId column or the ParentFolderId column must be specified in the criteria of the statement. Both columns can't be specified at the same time. Refer to the following query examples:
SELECT * FROM Activities WHERE ItemId = 'items/1eCy_Fks57HytPuam-OiaHGY4_15Py16eVM5bNDCHYXQ';
SELECT * FROM Activities WHERE ParentFolderId = 'items/1eCy_Fks57HytPuam-OiaHGY4_15Py16eVM5bNDCHYXQ';
- When ItemId is used, the add-in will read activity data only for a specific drive item.
- When ParentFolderId is used, the add-in will read activity data for all drive items (and sub-items recursively) in the specified folder.
The Activities view supports only a subset of columns for filtering. Below is a table containing those columns with their supported operations.
| Column | Supported Operators |
| ItemId | =, IN |
| ParentFolderId | =, IN |
| ActionType | =, IN, !=, NOT IN |
| Time | >, >=, <, <= |
The ActionType and Time pseudo-columns can only be used one time each (even if the same operator is used) in the criteria. Additionally, only the supported operators mentioned above can be used. If these conditions are not met, the query will fail. Refer to the following query examples below:
-- Valid
SELECT * FROM Activities WHERE ItemId = 'items/1eCy_Fks57HytPuam-OiaHGY4_15Py16eVM5bNDCHYXQ' AND Time > '2025-09-01T00:00:00.000' AND ActionType IN ('CREATE', 'EDIT');
-- Invalid, will fail.
SELECT * FROM Activities WHERE ItemId = 'items/1eCy_Fks57HytPuam-OiaHGY4_15Py16eVM5bNDCHYXQ' AND Time > '2025-09-01T00:00:00.000' AND Time > '2025-09-30T00:00:00.000' AND ActionType IN ('CREATE', 'EDIT'); -- Time pseudo-column is used 2 times.
SELECT * FROM Activities WHERE ItemId = 'items/1eCy_Fks57HytPuam-OiaHGY4_15Py16eVM5bNDCHYXQ' AND Time > '2025-09-01T00:00:00.000' AND ActionType IN ('CREATE', 'EDIT') AND ActionType NOT IN ('DELETE', 'RESTORE'); -- ActionType pseudo-column is used 2 times.
SELECT * FROM Activities WHERE ItemId = 'items/1eCy_Fks57HytPuam-OiaHGY4_15Py16eVM5bNDCHYXQ' AND Time != '2025-09-01T00:00:00.000' AND ActionType > 'CREATE'; -- Unsupported operators are used on both pseudo-columns.
Columns
| Name | Type | Description |
| ItemId | String | The identifier of the item related to the target in the activity. |
| ItemType | String | The type of the item.
The allowed values are FILE, FOLDER. |
| ItemName | String | The name of the item. |
| ItemMimeType | String | The MIME type of the item. |
| ItemOwner | String | The owner of the item. |
| ItemFolderType | String | The folder's type if the item is a folder.
The allowed values are TYPE_UNSPECIFIED, MY_DRIVE_ROOT, SHARED_DRIVE_ROOT, STANDARD_FOLDER. |
| TargetType | String | The type of object that was updated in the activity.
The allowed values are DRIVE_ITEM, DRIVE, FILE_COMMENT. |
| DriveId | String | The identifier of the drive, if the target in the activity is a drive. |
| DriveName | String | The name of the drive. |
| CommentId | String | The identifier of the comment, if the target in the activity is a file's comment. |
| DiscussionId | String | The identifier of the discussion related to the file comment. |
| DiscussionLink | String | The link to the discussion related to the file comment. |
| PrimaryActionType | String | The type of primary action that occurred in the activity.
The allowed values are CREATE, EDIT, MOVE, RENAME, DELETE, RESTORE, PERMISSION_CHANGE, COMMENT, DATA_LEAK_PREVENTION_CHANGE, APPLICATION_REFERENCE, SETTINGS_CHANGE, LABEL_CHANGE. |
| Actions | String | The actions that occurred in the activity. |
| ActorType | String | The type of actor responsible for the activity.
The allowed values are IMPERSONATED_USER, USER, ADMINISTRATOR, ANONYMOUS, SYSTEM_EVENT. |
| UserType | String | The type of user if the actor is a user.
The allowed values are KNOWN_USER, DELETED_USER, UNKNOWN_USER. |
| Username | String | The username of the user. |
| IsAuthenticatedUser | Boolean | Boolean value indicating whether the user is the connected user. |
| SystemEventType | String | The type of event if the actor is a system event.
The allowed values are TYPE_UNSPECIFIED, USER_DELETION, TRASH_AUTO_PURGE. |
| OccurredAt | Datetime | The exact time when the activity took place. |
| StartedAt | Datetime | The time when the activity started, if it took place during a time range instead of a specific time. |
| EndedAt | Datetime | The time when the activity ended, if it took place during a time range instead of a specific time. |
| ParentFolderId | String | The identifier of the folder whose activities you want to query including the activities in the children. |
Pseudo-Columns
Pseudo-column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.
| Name | Type | Description |
| ActionType | String | Filter the activities by the type of actions that occurred in them.
The allowed values are CREATE, EDIT, MOVE, RENAME, DELETE, RESTORE, PERMISSION_CHANGE, COMMENT, DATA_LEAK_PREVENTION_CHANGE, APPLICATION_REFERENCE, SETTINGS_CHANGE, LABEL_CHANGE. |
| Time | Datetime | Filter the activities by the time when they occurred. |