0

要求是 Windows 窗体应用程序可以访问列表列表,以便用户可以选择源列表和目标列表。

我在从网站集中访问列表时遇到问题。我通过_vti_bin/ListData.svc访问站点的XML ,在这里我可以获取SPECIFIC LIST的项目。

如何访问列表列表和移动文件?

这是我的代码:

private void setContents(string strSource, string strDestination, string strUser,
        string strPW, string strDomain)
    {
        sourceContent = new SourceSiteDataContext(
        new Uri(strSource));
        destinationContent = new DestinationSiteDataContext(
        new Uri(strDestination));

        userContext = new NetworkCredential();

        userContext.UserName = strUser;
        userContext.Password = strPW;
        userContext.Domain = strDomain;
        sourceContent.Credentials = userContext;
        destinationContent.Credentials = userContext;
    }

ArrayList list = new ArrayList();           
        var sourceQuery = from sourceList in sourceContent.SourceLibrary
                          select new
                          {
                              sourceList.Name
                          };
        foreach (var item in sourceQuery)
        {
            list.Add(item.Name);
        }

private void Form1_Load(object sender, EventArgs e)
    {
        setContents("http://[site]:[port]/_vti_bin/ListData.svc",
            "http://[site]:[port]//sites/DestinationSite/_vti_bin/ListData.svc",
            "admin", "admin", "localhost");
        setDropDown();

    }

这里的代码只能从代码中的特定列表中获取项目。

4

1 回答 1

1

列表服务仅用于提取信息。要执行更改,您需要使用 Sharepoint 客户端对象模型。

检查 MSDN http://msdn.microsoft.com/en-us/library/ee857094%28office.14%29.aspx

于 2013-08-28T19:16:39.763 回答