在 SharePoint 中显示所有不同版本的文档

Display all different version documents in SharePoint

我在 SharePoint 库中打开了版本控制功能。我想在视图中显示每个文档的所有不同版本。你能帮我解决这个问题吗?

感谢您的宝贵意见!

您是只显示版本还是应该点击将您带到相同的版本?请看下面的代码片段

`using (SPSite site = new SPSite("http://Mysite"))
{
using (SPWeb web = site.OpenWeb())
{
SPList docs = web.Lists["TestDocLibrary"];
foreach (SPFile file in docs.RootFolder.Files)
{
Console.WriteLine("File Name/URL:- {0} has next version {1}. Version     History:", file.Url, file.UIVersionLabel);
foreach (SPFileVersion v in file.Versions.Cast().Reverse())
{
Console.WriteLine("Version of the file :- {0} time of checkin :- {1} comments while checking in:- '{2}'", v.VersionLabel, v.Created, v.CheckInComment);
}
}
}
}`