Question

How to get the version number of a selected Ektron Content in Ektron 8.0.

 ContentAPI m_refContentApi = new ContentAPI();
 var data = m_refContentApi.GetHistoryList(ContentBlockId);

I have tried above code but it doesn't provide any Version number.

Anyone reply

Was it helpful?

Solution

I am guessing that the version number you speak of here is the version number as seen when viewing history of a content piece in the workarea. Working off of that...

I do not believe this version number is available as a property of the Ektron provided objects. If you require this version number you will need to duplicate the process used by Ektron to produce the version number.

This answer is based on analysis of the /workarea/controls/viewhistorylist.aspx.cs code. I am working with Ektron 8.6 SP1.
In the workarea the historical information is accessed using the following code:

Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi();
List<Ektron.Cms.Commerce.EntryVersionData> entry_version_list = new List<Ektron.Cms.Commerce.EntryVersionData>();
if (Id != -1)
{
    entry_version_list = m_refCatalogAPI.GetVersionList(Id, ContentLanguage);
}

The "Id" variable is the EktronId of the content piece.
Unfortunately this list itself does not contain the version number. There is a variable named VersionId but this is not the same as seen in the workarea user interface.

To obtain the Version used for printing Ektron loops through the elements in the list and checks if the content piece has been previously published. If a version was published, it is considered a major number and that appears to the left of the decimal and if it was not published, it is a minor number appearing to the right of the decimal.

If you do not need the number you are working with to match the workarea GUI then you might want to consider using the VersionId property. An smaller number indicates older content but if you need to differentiate between major an minor releases this will not do the trick and you will need to duplicate the process used by Ektron.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top