HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Content versions

Describes the various states a content version can have.

Version status 

A content item that supports different statuses implements IVersionable. The interface contains a property Status that specifies the current status of the content version. A content version can have one of the following different statuses:

  • NotCreated – The version is not yet saved.
  • CheckedOut – The version is being edited.
  • AwaitingApproval – The version is ready for approval.
  • Rejected – The version is not approved.
  • CheckedIn – The version is approved and ready for publishing.
  • DelayedPublish – The version is automatically published at a future date and time.
  • Published – The version is published.
  • PreviouslyPublished – The version was published but is now replaced with a different version.

Status transitions

You can specify a state transition programmatically by the parameter SaveAction in the call to IContentRepository.Save. Below are the different SaveAction parameters you can specify for state transitions and the outcome of the transition. CMS applies the transition to the current version unless the status is published or previously published, in which case it creates a version.

  • Default or None – Saves a version while maintaining the current status. If a version is created, it has a checked-out state.
  • Publish – Publishes a version.
  • Schedule – Schedules a version for automatic publishing at a later date.
  • CheckOut – Checks out a version to indicate it is being worked on.
  • CheckIn – Checks in a version indicating that it is ready to be published
  • RequestApproval – Saves a version to a state indicating it is ready to be approved.
  • Reject – Rejects a version; often done during an approval review.
  • Save – Saves action; the outcome depends on the current status. It will, in some cases, maintain the status and, in other cases, check out the current version.
    You can combine the state transition in the SaveAction with some option flags to specify how to perform the Save operation. The flags are:
    • ForceNewVersion – Create a version from the content saved.
    • ForceCurrentVersion – Update the existing version.
    • SkipValidation – Save the content without performing the usual validation.
    • SkipSetCommonDraft – Do not set the version as a common draft (the version used by default in the CMS edit user interface).
    • DelayedPublish – (Deprecated in CMS 10) Used in combination with SaveAction, use CheckIn to automatically publish the version at a specified date and time.

Locked content versions

You can lock a version for updates or transitions by implementing the IContentLockEvaluator interface. Versions, currently in AwaitingApproval state and where you specify an approval definition for the version are locked for updates by default. You can force updates by specifying SaveAction.SkipValidation. You should register an IContentLockEvaluator implementation in the IOC container to be consumed by CMS. See also Content approvals.