Files
Represents files stored in Box, including their content, metadata, ownership, and lifecycle information.
Table Specific Information
Select
If you query Files without specifying any condition in the WHERE Clause, only files up to 5 levels deep from the root folder are returned by default. You can change the default depth value in the connection string (for example, DirectoryRetrievalDepth=10).
SELECT * FROM Files;
By default, the search starts from the root directory, identified as directory '0'. To customize the starting directory for your search, specify its Id using the SearchRootId column.
SELECT * FROM Files WHERE SearchRootId = '293533136411';
To search all the Files in your enterprise, query the Files table with the SearchTerms column.
SELECT * FROM Files WHERE SearchTerms LIKE '%untitled%';
To search all the Files within a specific folder, query the Files table with a filter on the relevant folder's Id in the ParentId column.
SELECT * FROM Files WHERE ParentId = '12';
Note: When using a ParentId filter, avoid specifying a SearchRootId simultaneously. If both are used, the search will recursively start from the specified SearchRootId instead of the ParentId, which may result in slower performance.
Update
Any column where ReadOnly=False can be updated.
UPDATE Files SET Description = 'example description', Sharedlink = 'http://sharedlink.com', OwnedbyId = '321', ParentId = '12', Name = 'updated file name' WHERE Id = '123';
Delete
Delete a file by specifying its Id. This file is then moved to TrashedItems.
DELETE FROM Files WHERE Id = '100';
Columns
| Name | Type | ReadOnly | Description |
| SearchTerms | String | True |
Keywords used to search for files stored in Box. |
| Id [KEY] | String | True |
Unique identifier assigned to the file. |
| Name | String | False |
The display name of the file. |
| Sha1 | String | False |
The SHA-1 checksum of the file, used for content verification and deduplication. |
| Etag | String | False |
Version identifier for the file, used to track changes and manage concurrency. |
| SequenceId | String | False |
An incremental identifier representing the version sequence of the file. |
| Description | String | False |
A user-provided description that explains the file's purpose or contents. |
| Size | Integer | True |
The file size in bytes. |
| CreatedAt | Datetime | True |
The date and time when the file was originally created in Box. |
| ModifiedAt | Datetime | True |
The date and time when the file was last updated in Box. |
| TrashedAt | Datetime | True |
The date and time when the file was moved to the trash. |
| PurgedAt | Datetime | True |
The date and time when the file was permanently deleted from the trash. |
| ContentCreatedAt | Datetime | True |
The date and time when the file content was first created, which may differ from the Box creation date. |
| ContentModifiedAt | Datetime | True |
The date and time when the file content itself was last modified. |
| CreatedById | String | True |
Identifier of the user who created the file. |
| CreatedByName | String | True |
The full name of the user who created the file. |
| CreatedByLogin | String | True |
The login email of the user who created the file. |
| SharedLink | String | False |
A shareable URL that provides access to the file. |
| ModifiedById | String | True |
Identifier of the user who most recently modified the file. |
| ModifiedByName | String | True |
The full name of the user who most recently modified the file. |
| ModifiedByLogin | String | True |
The login email of the user who most recently modified the file. |
| OwnedById | String | False |
Identifier of the user who owns the file. |
| OwnedByName | String | False |
The full name of the user who owns the file. |
| OwnedByLogin | String | False |
The login email of the user who owns the file. |
| ParentId | String | False |
Identifier of the folder that contains the file. |
| ItemStatus | String | False |
The current state of the file, such as active or trashed. |
| Path | String | True |
The full folder path leading to the file within the Box hierarchy. |
| SearchRootId | String | True |
Identifier of the folder to use as the starting point for recursive searches, with '0' representing the root folder. |
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 |
| Scope | String |
The scope of the file search, such as limiting results to a user or enterprise. |
| FileExtension | String |
The file's extension, such as PDF or DOCX. |
| ContentTypes | String |
Specifies which file fields to search against, separated by commas. Possible values include name, file_content, description, comments, and tags. |
| OwnerUserIDs | String |
A list of user identifiers separated by a comma, used to restrict searches to files owned by specific users. |
| AncestorfolderIDs | String |
A list of folder identifiers separated by a comma, used to restrict searches to files contained within specific folders. |
| AsUserId | String |
Identifier of the user to impersonate for API requests, available only for Admin, Co-Admin, and Service Accounts. |