Folders
Represents folders in Box, including their structure, contents, and metadata, with full create, update, delete, and query capabilities.
Table Specific Information
Select
If you query Folders 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; e.g. DirectoryRetrievalDepth=10.
SELECT * FROM Folders;
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 Folders WHERE SearchRootId = '293533136411';
To search all the Folders in your enterprise, query the Folders table with the SearchTerms column.
SELECT * FROM Folders WHERE SearchTerms LIKE '%untitled%';
To search all the Folders within a specific folder, query the Folders table with the ParentId column.
SELECT * FROM Folders 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.
If you're authenticated as an administrator with user impersonation permissions, you can query folders from multiple user accounts:
SELECT * FROM Folders WHERE AsUserId IN (SELECT Id FROM Users);
Note: User impersonation has the following limitations:
- The authenticated user cannot be impersonated unless that user is a service account.
- If the authenticated user is a standard user account, they can only query folders associated with their account.
- Folders shared with multiple users are only returned for one of the users.
Insert
You must specify the name of the Folder and also the Id of the parent Folder. Use 0 for the root Folder's ParentId.
INSERT INTO Folders (Name, ParentId, SharedLink, Description, Access, OwnedById) VALUES ('new folder', '0', 'http://sharedlink.com', 'example desc', 'open', '123');
Update
Any column where ReadOnly=False can be updated.
UPDATE Folders SET Description = 'example description', Access = 'open', SharedLink = 'http://sharedlink.com', OwnedById = '321', ParentId = '12', Name = 'no longer new folder' WHERE Id = '123';
Delete
Delete a folder by specifying its Id:
DELETE FROM Folders WHERE Id = '123';
Columns
| Name | Type | ReadOnly | Description |
| SearchTerms | String | True |
Keywords used to search for folders stored in Box. |
| Id [KEY] | String | True |
Unique identifier assigned to the folder. |
| Name | String | False |
The display name of the folder. |
| Etag | String | True |
Version identifier for the folder, used to detect changes and manage concurrency. |
| SequenceId | String | True |
An incremental identifier representing the version sequence of the folder. |
| Description | String | False |
A user-provided description that explains the purpose or contents of the folder. |
| Access | String | False |
The email addresses of users who have been granted access to the folder. The allowed values are open, collaborators. |
| Size | Integer | True |
The total size of the folder contents, measured in bytes. |
| CreatedAt | Datetime | True |
The date and time when the folder was originally created in Box. |
| ModifiedAt | Datetime | True |
The date and time when the folder's metadata or contents were last updated. |
| TrashedAt | Datetime | True |
The date and time when the folder was moved to the trash. |
| PurgedAt | Datetime | True |
The date and time when the folder was permanently deleted from the trash. |
| ContentCreatedAt | Datetime | True |
The date and time when the first content item inside the folder was created. |
| ContentModifiedAt | Datetime | True |
The date and time when the most recent content inside the folder was modified. |
| CreatedBy | String | True |
Identifier of the user who created the folder. |
| CreatedByName | String | True |
The full name of the user who created the folder. |
| CreatedByLogin | String | True |
The login email of the user who created the folder. |
| SharedLink | String | False |
A shareable URL that provides access to the folder. |
| ModifiedBy | String | True |
Identifier of the user who last modified the folder. |
| ModifiedByName | String | True |
The full name of the user who last modified the folder. |
| ModifiedByLogin | String | True |
The login email of the user who last modified the folder. |
| OwnedById | String | False |
Identifier of the user who owns the folder. |
| OwnedByName | String | True |
The full name of the user who owns the folder. |
| OwnedByLogin | String | True |
The login email of the user who owns the folder. |
| ParentId | String | False |
Identifier of the parent folder that contains this folder. |
| ItemStatus | String | True |
The current state of the folder, such as active or trashed. |
| Path | String | True |
The full folder path leading to the folder within the Box hierarchy. |
| AsUserId | String | False |
Identifier of the user to impersonate for API requests, available only for Admin, Co-Admin, and Service Accounts. |
| 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 folder search, such as limiting results to a user or enterprise. |
| ContentTypes | String |
Specifies which folder-related 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 folders owned by specific users. |
| AncestorfolderIDs | String |
A list of folder identifiers separated by a comma, used to restrict searches to folders contained within specific parent folders. |