0

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 ?

0

Try using fileVersion.Properties["display_urn:schemas-microsoft-com:office:office#Editor"].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.