Special Access Rules
Chatter and Files Connect must be enabled for the organization.
Supported Calls
describeSObjects(), query(), search()
Fields
| Field Name | Details |
|---|---|
| ContentHubRepositoryId |
|
| ContentItemSize |
|
| ContentModifiedDate |
|
| ContentSize |
|
| Description |
|
| ExternalContentUrl |
|
| ExternalDocumentUrl |
|
| ExternalId |
|
| FileExtension |
|
| FileType |
|
| IsFolder |
|
| MimeType |
|
| Name |
|
| Owner |
|
| ParentId |
|
| Title |
|
| UpdatedBy |
|
Usage
The following SOQL query examples show how to retrieve files and folders from a Files Connect external data source. These examples use placeholders for ID values for the repository ID and folder IDs. Before running these queries, replace the placeholders with valid ID values for your external data source and folders.
Example 1: Get the ID and name of the root folder in an external file source.
SELECT Id, Name FROM ContentHubItem WHERE ContentHubRepositoryId = '<repository ID>' AND ParentId = NULL
Example 2: List all folders and files under the specified root folder.
SELECT Id, Name FROM ContentHubItem WHERE ContentHubRepositoryId = '<repository ID>' AND ParentId = '<root folder ID>'
Example 3: List all external file data sources by querying ContentHubRepository.
SELECT DeveloperName FROM ContentHubRepository
Example 4: List all files and folders in a given folder and external file source.
SELECT Id, Name FROM ContentHubItem WHERE ContentHubRepositoryId = '<repository ID>' AND ParentId = '<parent folder ID>'
Example 5: To return only folders in the result set, add IsFolder = true in the WHERE clause to a query that returns files and folders. For example, the following query lists all folders under the root folder.
SELECT Id, Name
FROM ContentHubItem
WHERE ContentHubRepositoryId = '<repository ID>' AND ParentId = '<root folder ID>'
AND IsFolder = true
Example 6: Retrieve a link that is used to open the specified document in an external source.
SELECT ExternalDocumentUrl FROM ContentHubItem WHERE ContentHubRepositoryId = '<repository ID>' AND Id = '<document ID>'
SOSL Example: Retrieve the ID and name of all documents that contain the search string. The result set is limited to the first 10 documents.
FIND {<search string>}
RETURNING ContentHubItem(Id, Name
WHERE ContentHubRepositoryId = '<repository ID>')
LIMIT 10