I am writing a tool to generate the versions of a file/page in the library. My Report should include the version number and the version created by/Modified by name.
While getting the modified by column for the version through code it is giving a username which is not same on the sharepoint UI.
This is the code im using to get the modified by value of a version
SPFolder folder = file.ParentFolder; SPFileVersionCollection fileVersions = file.Versions; if (fileVersions.Count > 0) { foreach (SPFileVersion fileVersion in fileVersions) { if (fileVersion.Properties["vti_modifiedby"] != null) { string author = Convert.ToString(fileVersion.Properties["vti_modifiedby"]); Console.WriteLine("file version" + fileVersion.VersionLabel + " Author " + author); }
}
}
Any Idea ?