Return to doc.sitecore.com

Valid for Sitecore 5.2, 5.1.1
  Add the GetItemVersions Method
Prev Next

Create a method that gets a list of the available versions of an item:

    /// <summary>
    /// Gets a list of the available versions of an item.
    /// </summary>
    /// <param name="itemDefinition">The item.</param>
    /// <param name="context">The context.</param>
    /// <returns></returns>
    public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) {
      LanguageCollection languages = GetLanguages(context);
     
      if(languages == null){
        return null;
      }

      VersionUriList result = new VersionUriList();

      foreach(Language language in languages){
        result.Add(language, Version.First);
      }

      return result;
    }

Download the code 


Prev Next