sharepoint - 比较 SharePoint 2010 中的两个列表

标签 sharepoint sharepoint-2010

我正在使用 SharePoint 2010,需要比较两个网站。比较必须包括这些网站内的列表。我需要知道除了列表内容之外是否还有什么需要比较的? 另外,比较两个列表的最佳方法是什么?

最佳答案

这是一个基本示例,您可能会做一些更复杂的事情,特别是如果您想使用自定义 CamlQuery 来过滤项目或检查列表的设置。

using(ClientContext ctx = new ClientContext("http://url.to.site.com/"))
{
    Web web = ctx.Web;
    List list = web.Lists.GetByTitle("Pages");
    ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());

    ctx.Load(list);
    ctx.Load(items);

    ctx.ExecuteQuery();

    // after the ExecuteQuery call, list and items will contain references
    // to the lists and the items in the list.
}

确保引用 Microsoft.SharePoint.Client.dllMicrosoft.SharePoint.Client.Runtime.dll。这些可以在场中一台 SharePoint 服务器上的 C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI 中找到。将它们复制到您的项目并引用它们。

有关客户端对象模型的更多信息,我建议查看这篇文章:http://msdn.microsoft.com/en-us/library/ee857094.aspx

关于sharepoint - 比较 SharePoint 2010 中的两个列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10919464/

相关文章:

Sharepoint 2010 - 使用自定义站点模板从代码创建站点

javascript - 尝试使用 javascript 在 sharepoint 中创建子任务,但 clientContext 似乎返回 [object object]

sharepoint - 为什么 $Resources :wss work in a web control, 但 $Resources :core does not?

sharepoint-2010 - 使用powershell在sharepoint中获取给定服务器中的所有WebApplication

SharePoint 搜索未索引文档库的内容

javascript - 在 Sharepoint 工作流表单中,如何在单击开始或取消后关闭表单

sharepoint - 自定义选项卡上的自定义按钮始终处于禁用状态(功能区栏)

sharepoint - 删除 PlaceHolderPageTitleInTitleArea 的内容

javascript - 比较 SharePoint 列表中的两个 int 列

web-services - 无法使用 Sharepoint Web 服务中的 GetListItems 获取列表的所有字段