Represents a specific version of a document in Salesforce CRM Content or
file in Chatter. The maximum number of versions that can be published in a
24-hour period is 5,000. This object is available in versions 17.0
and later for Salesforce CRM Content documents.
This object is available in versions 20.0 and later for Chatter files.
Customer and Partner Portal users must have the “View Content
in Portal” permission to query content in libraries where
they have access.
Customer and Partner Portal users can only publish, version, or
edit documents if they have a Salesforce CRM Content feature
license.
All users with a content feature license can create versions in
their personal library.
Users (including users with the
“View All Data” permission) can only query files they
have access to, including:
All Salesforce CRM Content files in libraries they're a member of and in their personal
library, regardless of library permissions (version 17.0 and later).
All Chatter files they own, posted on their profile, posted on groups they can
see, and shared directly with them (version 21.0 and later).
All users can update versions in their personal library.
The owner of a version or document can update the document if
they are a member of the library, regardless of library permissions.
To update a Salesforce CRM Content document,
the user must be a member of the library with one of these library
privileges enabled:
“Add Content”
“Add Content On Behalf of Others”
“Manage Library”
FileType is defined by either ContentUrl for links or PathOnClient for documents, but not both.
Fields
Field
Details
ContentDocumentId
Type
reference
Properties
Create, Filter, Group, Sort
Description
ID of the document.
ContentModifiedById
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the user who modified the document.
ContentModifiedDate
Type
dateTime
Properties
Filter, Nillable, Sort
Description
Date the document was modified.
ContentSize
Type
int
Properties
Filter, Group, Nillable, Sort
Description
Size of the document in bytes. Always zero for links.
ContentUrl
Type
url
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
URL for links. This is only set for links. One of the fields that
determines the FileType.
Description
Type
textarea
Properties
Create, Filter, Nillable, Sort, Update
Description
Description of the content version.
Division
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
A logical segment of your organization’s
data. Available only if the organization has the Division permission
enabled.
FeaturedContentBoost
Type
int
Properties
Filter, Group, Nillable, Sort,
Description
Read only. Designates a document as featured.
FeaturedContentDate
Type
date
Properties
Filter, Group, Nillable, Sort
Description
Date the document was featured.
FileType
Type
string
Properties
Filter, Group, Sort
Description
Type of content determined by ContentUrl for links or PathOnClient for documents.
FirstPublishLocationId
Type
reference
Properties
Create, Filter, Group,Nillable, Sort,
Description
ID of the location where the version was first published. If
the version is first published into a user's personal library or My
Files, the field will contain the ID of the user who owns the personal
library or My Files. If the first version is published into a public
library, the field will contain the ID of that library.
This
field is only set the first time a version is published via the API.
It isn't set when a version is published in Salesforce CRM Content or
uploaded in Chatter. After the version is published, it is a read-only field.
If you don't set a FirstPublishLocationId via the API,
this field defaults to the user's personal library, unless Origin is set to H, then this field defaults to My Files.
IsLatest
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Indicates whether this is the latest version of the document
(true) or not (false).
The language for this document. This field defaults to the user's
language unless the organization is multi-language enabled.
Specifies the language of the labels
returned. The value must be a valid user locale (language and country),
such as de_DE or en_GB. For more information on locales,
see the Language field on the CategoryNodeLocalization object.
NegativeRatingCount
Type
int
Properties
Filter, Group, Nillable, Sort
Description
Read only. The number of times different users have given the
document a thumbs down.
Rating counts for the latest version are
not version-specific. If Version 1 receives 10 thumbs-down votes,
and Version 2 receives 2 thumbs-down votes, the NegativeRatingCount on Version 2 is 12. However, rating counts are not retroactive
for prior versions. The NegativeRatingCount on Version 1 is 10.
Origin
Type
picklist
Properties
Create, Filter, Group, Restricted picklist, Sort
Description
The source of the content version. Valid values are:
C—This is a Content document from the user's personal
library. Label is Content. The FirstPublishLocationId must be the user's ID. If FirstPublishLocationId is left blank, it defaults to the user's ID.
H—This is a Chatter file from the user's My Files.
Label is Chatter. The FirstPublishLocationId must be the user's ID. If FirstPublishLocationId is left blank, it defaults to the user's ID. Origin can only be set to H if Chatter is enabled for your organization.
This field defaults to C. Label is Content Origin.
OwnerId
Type
reference
Properties
Create, Defaulted on create, Filter, Group, Sort, Update
Description
ID of the owner of this document.
PathOnClient
Type
string
Properties
Create, Filter, Nillable, Sort
Description
The complete path of the document. One of the fields that determines
the FileType.
PositiveRatingCount
Type
int
Properties
Filter, Group, Nillable, Sort,
Description
Read only. The number of times different users have given the
document a thumbs up.
Rating counts for the
latest version are not version-specific. If Version 1 receives 10
thumbs-up votes, and Version 2 receives 2 thumbs-up votes, the PositiveRatingCount on Version 2 is 12. However, rating counts are not retroactive
for prior versions. The PositiveRatingCount on Version 1 is 10.
PublishStatus
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
Indicates if and how the document
is published. Valid values are:
P—The document is
published to a public library and is visible to other users. Label
is Public.
R—The document is
published to a personal library and is not visible to other users.
Label is Personal Library.
U—The document is
not published because publishing was interrupted. Label is Upload Interrupted.
RatingCount
Type
int
Properties
Filter, Group, Nillable, Sort
Description
Read only. Total number of positive and negative ratings.
ReasonForChange
Type
string
Properties
Create, Filter, Nillable, Sort
Description
The reason why the document was changed. This field can only
be set when inserting a new version (revising) a document.
RecordTypeId
Type
reference
Properties
Create, Filter, Nillable, Update
Description
ID of the content type of the version. Content types are containers
for custom fields in Salesforce CRM Content.
Custom fields are restricted in RecordTypeId. When an administrator creates a custom field via the API it
must be added to at least one content type:
If the custom field is added to the default (General) content
type, the RecordTypeId that corresponds to that content type does not have to be set on
the version record.
If the custom field is added to a custom content type, the RecordTypeId that corresponds to that content type must be set on the version
record.
TagCsv
Type
textarea
Properties
Create, Nillable, Sort, Update
Description
Text used to apply tags to a content version via the API.
Title
Type
string
Properties
Create, Filter, Group, Sort,Update
Description
The title of a document.
VersionData
Type
base64
Properties
Create, Nillable
Description
Encoded file data. This field can't be set for links. The maximum file size you can
upload via the SOAP API must
be less than 50 MB. When a document is uploaded or downloaded via
the API, it is converted to base64 and stored in VersionData. This conversion increases the document size by approximately 37%.
You must account for the base64 conversion increase so that the file
you plan to upload is less than 50 MB.
VersionNumber
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The version number. The number increments with each version of
the document, for example, 1, 2, 3.
Usage
Use this object to create, query,
retrieve, search, edit, and update a specific version of a Salesforce CRM Content document
or Chatter file. Use the ContentDocument 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.
If Chatter isn't enabled, Chatter files aren't included in query results.
You can't query files that are
only on records, whether they're public or not.
Not all fields can be set for Chatter files.
You can only update a version if it is the latest version and
if it is published.
You can't archive versions.
You can't change content types on versions.
You can't delete a version via the API.
The maximum file size you can
upload via the SOAP API must
be less than 50 MB. When a document is uploaded or downloaded via
the API, it is converted to base64 and stored in VersionData. This conversion increases the document size by approximately 37%.
You must account for the base64 conversion increase so that the file
you plan to upload is less than 50 MB.
To download a document via the API,
you must export the VersionData of the document. This does not increase the download count.
When you upload a document from your local drive using the Data
Loader, you must specify the actual path in both VersionData and PathOnClient. VersionData identifies the location and extracts the format and PathOnClient identifies the type of document being uploaded.
SOQL queries on the ContentVersion object
return all versions of the document. SOSL searches on the ContentVersion object
return only the most recent version of the document.
If you query versions in the API,
versions with a PublishStatus of Upload Interrupted are not returned.
Documents published into a personal library assume the default
(General) content type.
Contact Manager, Group, Professional, Enterprise,
and Unlimited Edition customers can publish a maximum of 5,000 new
versions per 24–hour period. Developer Edition and trial users
can publish a maximum of 2,500 new versions per 24–hour period.
Custom validation rules can prevent an update of documents published
into a personal library via the API.
ContentVersion API Tagging
Tags can be applied to ContentVersion records
using either Enterprise or Partner API.
To apply tags to a ContentVersion record,
set a value in the TagCsv field. For example, setting this field to one,two,three creates and associates three tags to that
version.
The maximum length of the TagCsv field is 2,000 characters.
The maximum length of an individual tag is 100 characters.
When tags are applied to a version, the content is indexed automatically
and the tags are searchable.
You can't apply tags to a TagCsv that is published into a personal library.
You can't apply tags using the ContentDocument object.
You can't change or delete tag names. You can remove tags from
a document, but that doesn't delete the tag.
Tags are case insensitive. You can't have two tags with the same
name even if they use different uppercase and lowercase letters.
The case of the original tag is always used.
To delete tags from a ContentVersion record,
perform a standard API update,
and remove any values from the TagCsv field that you want to delete. For example, if the original TagCsv is one,two,three, perform an API update
specifying one,three in the TagCsv field to delete two. To delete
all tags from a ContentVersion you
perform a standard API update
by setting the field to null.
If you create a ContentVersion record
and want to revise it via the API,
you insert another ContentVersion record
but associate it to the same ContentDocument record as the original. This has an impact on tagging:
If you insert the revision and do not set any value in the TagCsv field, any tags applied to the previous version are automatically
applied to the new version.
If you insert the revision and specify a new TagCsv field, no tags transfer over and the tags you specify are applied
instead.
When you perform a SOQL query for a ContentVersion record
and select the TagCsv field, all the tags associated with that record are returned. The
tags in the string are always ordered alphabetically even if they
were inserted in a different order. You can't use the TagCsv field as part of a filter in a SOQL query. You can't query all tags
in your organization.
Library tagging rules:
API tagging respects the tagging restrictions that exist on any
library that the document is published into. For example, if the
library is in restricted tagging mode and only allows tags one,three, you can't save a version with
a TagCsv of one,two,three.
If the library is in guided tagging mode, you can apply tags to
the ContentVersion. You can't query the value of guided tags on a library, but you
can query the tagging model of a library.