【问题标题】:SharePoint: Move files from one document library to another using Web ServicesSharePoint:使用 Web 服务将文件从一个文档库移动到另一个文档库
【发布时间】:2013-08-28 06:51:46
【问题描述】:

要求是 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();

    }

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

【问题讨论】:

    标签: c# web-services sharepoint-2010


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-21
      • 1970-01-01
      • 2010-11-21
      • 2014-05-22
      • 1970-01-01
      相关资源
      最近更新 更多