Search code examples
tridiontridion-2011

How can I get the version number of an selected item in tridion?


How can I get the version number of an selected item (Component/Page)

I am using the below code

VersionedItemData verinfo=csClient.Read(<selecteditemid>, new ReadOptions()) 
                                                         as VersionedItemData;
<selecteditemid> = Component/Page id

Solution

  • Version and Revision properties are available in FullVersionInfo, so you have to cast VersionInfo of your item:

    ((FullVersionInfo) verinfo.VersionInfo).Version