Newer Version Available
ContentHubItem
Special Access Rules
Chatter and Files Connect must be enabled for the organization.
Supported Calls
describeSObjects(), query(), search()
Fields
| Field Name | Details |
|---|---|
| ContentHubRepositoryId |
|
| 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.
1SELECT Id, Name
2FROM ContentHubItem
3WHERE ContentHubRepositoryId = '<repository ID>' AND ParentId = NULLExample 2: List all folders and files under the specified root folder.
1SELECT Id, Name
2FROM ContentHubItem
3WHERE ContentHubRepositoryId = '<repository ID>' AND ParentId = '<root folder ID>'Example 3: List all external file data sources by querying ContentHubRepository.
1SELECT DeveloperName
2FROM ContentHubRepositoryExample 4: List all files and folders in a given folder and external file source.
1SELECT Id, Name
2FROM ContentHubItem
3WHERE 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.
1SELECT Id, Name
2FROM ContentHubItem
3WHERE ContentHubRepositoryId = '<repository ID>' AND ParentId = '<root folder ID>'
4 AND IsFolder = trueExample 6: Retrieve a link that is used to open the specified document in an external source.
1SELECT ExternalDocumentUrl
2FROM ContentHubItem
3WHERE 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.
1FIND {<search string>}
2RETURNING ContentHubItem(Id, Name
3 WHERE ContentHubRepositoryId = '<repository ID>')
4LIMIT 10