Folders
Create, update, delete, and query the available Folders in Box.
Table Specific Information
Select
If you search for folders without specifying any condition in the WHERE Clause, by default only the folders that are at most 5 levels deep from the root folder will be returned. You can change the default depth value in the connection string; e.g. DirectoryRetrievalDepth=10.
SELECT * FROM Folders
To search all the Folders in your enterprise, query the Folders table with the column SearchTerms.
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'
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're required to 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
Folders can be deleted by providing an Id and issuing a DELETE statement.
DELETE FROM Folders WHERE Id = '123'
Columns
Name | Type | ReadOnly | Description |
SearchTerms | String | True |
Query to search the folders database. |
Id [KEY] | String | True |
The Id of the folder. |
Name | String | False |
The name of the folder. |
Etag | String | True |
The Etag of the folder |
SequenceId | String | False |
The sequence Id of the folder. |
Description | String | False |
The description of the folder. |
Access | String | False |
The email access of this folder to. The allowed values are open, collaborators. |
Size | Integer | True |
The size of the file. |
CreatedAt | Datetime | True |
The date the file was created at. |
ModifiedAt | Datetime | True |
The date the file was modified at. |
TrashedAt | Datetime | True |
The date the folder was trashed at. |
PurgedAt | Datetime | True |
The date the folder was purged at. |
ContentCreatedAt | Datetime | True |
The date the content of the folder was created at. |
ContentModifiedAt | Datetime | True |
The date the content of the folder was modified at. |
CreatedBy | String | True |
The Id of the user that created the folder. |
CreatedByName | String | True |
The Name of the user that created the folder. |
CreatedByLogin | String | True |
The Login of the user that created the folder. |
SharedLink | String | False |
The Id of the user that created the folder. |
ModifiedBy | String | True |
The Id of the user that last modified the folder. |
ModifiedByName | String | True |
The Name of the user that last modified the folder. |
ModifiedByLogin | String | True |
The Login of the user that last modified the folder. |
OwnedById | String | False |
The Id user that owns the folder. |
OwnedByName | String | True |
The Name of the user that owns the folder. |
OwnedByLogin | String | True |
The Login of the user that owns the folder. |
ParentId | String | False |
The Id of the folder that contains the folder. |
ItemStatus | String | True |
The status of the folder. |
Path | String | True |
The full path of the folder. |
AsUserId | String | False |
The Id of the user you want to impersonate. Only works with Admin, Co-Admin and Service Accounts. |
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 search. |
ContentTypes | String |
The content to search the query at, separated by commas. This can contain a mixture of the following: name, file_content, description, comments, tags. |
OwnerUserIDs | String |
The Ids of the owners to limit the search to, separated by a comma. |
AncestorfolderIDs | String |
The Ids of the folders to limit the search to, separated by a comma. |