ContentVersion

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 36,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.

Supported Calls

create(), describeLayout(), describeSObjects(), query(), retrieve(), search(), update(), upsert()

Special Access Rules

Fields

Field Details
Checksum
Type
string
Properties
Filter, Group, Nillable, Sort
Description
MD5 checksum for the file.
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).
Language
Type
picklist
Properties
Create, Filter, Nillable, Restricted picklist, Update
Description
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.

NetworkId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort
Description
ID of the community that this file originated from. This field is available in API version 26.0 and later, if Salesforce Communities is enabled for your organization.

You can only add a NetworkId when creating a file. You can’t change or add a NetworkId for an existing file.

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.
Note
You must specify a complete path including the path extension in order for the document to be visible in the Preview tab.
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

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.

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:

© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.