I asked this same question in the SP2013 forum and I haven't been able to determine the solution. So I posting this here, to maybe get more eyes on this issue.
...I am basically trying to programmatically get the current version of a document in a library, then determine if its a major or minor version, in code. I have tried doing this, to get the current version but I keep getting an empty string returned.
var versions = item.File.Versions;
string currentVersion = string.Empty;
foreach (SPListItemVersion version in item.Versions)
{
DateTime lastMod = version.Created;
foreach (SPFileVersion fileVersion in versions)
{
if (fileVersion.IsCurrentVersion == true)
{
currentVersion = fileVersion.ToString();
}
}
}Does anyone know what am doing wrong, and how to get this resolved? I really appreciate the help. Thanks