我在SharePoint库中打开了版本控制功能。我想在视图中显示每个文档的所有不同版本。你能帮帮我吗?
感谢您的任何建议!
答案 0 :(得分:0)
您只是展示版本还是应该onclick带您到相同的版本?请看下面的代码片段
`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);
}
}
}
}`