怎么用Microsoft.sharepoint.Client.dll 来获取Version History 的ListItem 详细信息
问题是这样的:
我可以用 Microsoft.Sharepoint.dll 来获取历史版本的详细信息,如下:
SPListItem item.Versions[i]["Stage"].ToString();
但是,现在我需要用 客户端方法,即用引用 这个Microsoft.sharepoint.Client.dll
代码如下:
ListItem item.Versions[i]["Stage"].ToString();
// 在这里就有问题了,说 'Microsoft.SharePoint.Client.ListItem‘不包含Versions这个方法。我想获取历史版本信息,该如何做呢。通过Microsoft.sharepoint.Client.dll 。
源提示如下:
Error 23 'Microsoft.SharePoint.Client.ListItem' does not contain a definition for 'Versions' and no extension method 'Versions' accepting a first argument of type 'Microsoft.SharePoint.Client.ListItem' could be found (are you missing a using directive or an assembly reference?)
[解决办法]
用SharePoint WebService
[解决办法]
但SharePoint 2010 Web Services有一个接口可以用来获得一个列表项指定字段的历史版本数据。
http://Site/_vti_adm/Lists.asmx接口的GetVersionCollection()方法:
public XmlNode GetVersionCollection(
string strlistID, // 列表的ID
string strlistItemID, // 列表项的ID
string strFieldName // 要获取的字段的名称
)
返回值中将包含指定列表项的指定列表的历史版本数据。