[英]Accessing properties in a SharePoint 2010 ListItem for version history
我有一个自定义应用程序,该应用程序使用SharePoint 2010来存储列表项并对其进行版本控制。 搜索通过搜索服务进行,并且使用客户端对象模型成功进行了更新。 现在,我们正在尝试检索列表项旧版本的自定义属性,以显示给用户,这与SharePoint如何显示历史记录信息,提取文件版本然后显示更改后的属性的列表类似。
现在,我们有了以下内容,但是该文件的版本未显示任何可用于显示的属性,即使SharePoint在屏幕上查看历史记录时也显示了更改。
using (ClientContext context = new ClientContext(spURL)) {
Web site = context.Web;
context.Load(site);
context.ExecuteQuery();
File file = site.GetFileByServerRelativeUrl(sRelativeObjectPath);
context.Load(file);
context.ExecuteQuery();
FileVersionCollection versions = file.Versions;
context.Load(versions);
context.ExecuteQuery();
foreach (FileVersion ver in versions)
{
File verFile = site.GetFileByServerRelztiveUrl(ver.Url);
context.Load(verFile, f => f.ListItemAllFields);
//verFile.ListItemAllFields.FieldValues are null, need to get the properties of the ListItem
}
}
关于我应该如何获取版本的属性值的任何想法? 这不能在SharePoint中运行,因此我无权访问SharePoint.dll以使用SPQuery和SPItem。
在File
类中,具有File.ListItemAllFields
属性 ,您可以使用关联的列表项及其字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.