There is always a confusion between SPFile.Versions.Count & SPListItem.Versions.Count, as to which one to use and what is its purpose.
SPListItem.Versions.Count is always 1 more than SPFile.Versions.Count. The reason is SPFile consider the latest version as the current version and therefore does not include this in its version collection.
Thus, SPListItem.Versions.Count[1] is equal to SPListItem.SPFile.Versions.Count[0].
if you go to version history of a document , you will get a count equal to SPListItem.Versions.Count
Thus SPListItem.Versions.Count will give you, an exact version count of a document.
Thus, SPListItem.Versions.Count[1] is equal to SPListItem.SPFile.Versions.Count[0].
if you go to version history of a document , you will get a count equal to SPListItem.Versions.Count
Thus SPListItem.Versions.Count will give you, an exact version count of a document.
thanks man
ReplyDelete