Sitecore 5.0 API

Item.Versions Property

Provides access to different versions of the item.

[Visual Basic]
Public ReadOnly Property Versions As ItemVersions
[C#]
public ItemVersions Versions {get;}

Remarks

An item may have multiple versions within a language. Only one version is published at a time and therefore viewable on the website. A version is identified by an integer number.

Example

The following example builds a listview control containing icons for each version of an item.

public void DisplayVersions(Control parent, Item item) {
  foreach (Item version in item.Versions.GetVersions()) {
    ListviewItem listviewItem = new ListviewItem();

    Sitecore.Context.ClientPage.AddControl(parent, listviewItem);

    listviewItem.ID = "Version" + version.Version.Number.ToString();
    listviewItem.Header = version.Version.Number.ToString();
    listviewItem.Icon = version.Appearance.Icon;
  }
}

See Also

Item Class | Sitecore.Data.Items Namespace