Use this object to retrieve, query, update, and delete the latest version of a document, but not a content pack, in a library or a file in Chatter.
Usage
- Use this object to retrieve, query, update, and delete the latest version of a document, but not a content pack, in a library or a file in Chatter. Use the ContentVersion object to create, query, retrieve, search, edit, and update a specific version of a Salesforce CRM Content document or Chatter file.
- The query() call doesn’t return archived documents. The queryAll() call returns archived documents.
- You can’t add new versions of archived documents.
- If Chatter isn't enabled, Chatter files aren't included in query results.
- To query a file that is shared only with a record, you must specify the content ID of the file.
- To create a document, create a new version via the ContentVersion object without setting the ContentDocumentId. This automatically creates a parent document record. When adding a new version of the document, you must specify an existing ContentDocumentId which initiates the revision process for the document. When the latest version is published, the title, owner, and publish status fields are updated in the document.
- When you delete a document, all versions of that document are deleted, including ratings, comments, and tags.
- You can't create, edit, or delete content packs via the API.
Note
Content metadata, such as tags, custom fields, and content owners are tracked at the version level rather than at the document level.
- If you query versions in the API, versions with a PublishStatus of Upload Interrupted are not returned.
- A document record is a container for multiple version records. You create a new version to add a document to the system. The new version contains the actual file data which allows the document to have multiple versions. The version stores the body of the uploaded document.