【问题标题】:SharePoint Webservices GetListsSharePoint Web 服务获取列表
【发布时间】:2011-10-28 21:51:10
【问题描述】:

我在尝试使用与站点挂钩的 Lists.asmx 访问特定站点的文档库的子文件夹中的文档时遇到重大问题。我能够传递文档库的 GUID 并获取其下的文件夹和文件列表,但我无法获取文档库下文件夹中的文件。

这是我的一些代码:

 Lists lists = new Lists();
            lists.Credentials = System.Net.CredentialCache.DefaultCredentials;

           // string listName = "{8F6C3E9B-3160-4EC9-94CB-763DCAE966CB}";
           // string listName = "{FA20F595-A568-4FFA-AAAD-C81EFCBD3C42}";
           // string listName = "{12B07CC9-9391-49BA-93A3-9C385F21ABD1}";
            string listName = "Document%20Library";
            string viewName = "";
            string tbDetails = "";

            // Instantiate an XmlDocument object        
            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            System.Xml.XmlNode query = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
            System.Xml.XmlNode viewFields = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");
            System.Xml.XmlNode queryOptions = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");

            /*Use CAML query*/

            queryOptions.InnerXml = @"<QueryOptions><ViewAttributes Scope='RecursiveAll'/> </QueryOptions> ";

            // Get Items related to Customers
            XmlNode ndListItems = lists.GetListItems(listName, "", query, viewFields, null, queryOptions, null);

我一直在 ndListItems 内部查看,我只看到文件夹,而不是其中的内容。我还尝试将 GUID 用于我想在其中查看的文件夹,但它失败并出现错误:

列表不存在。 您选择的页面包含一个不存在的列表。它可能已被其他用户删除。 0x82000006

有什么想法吗?

【问题讨论】:

    标签: web-services sharepoint list


    【解决方案1】:

    尝试将列表名称更改为带有空格的“文档库”,而不是 %20。

    【讨论】:

    • @user479323 如果您的 Lists Web 服务引用了Http://siteurl.com/site1/_vti_bin/Lists.asmx,则文档库应位于site1
    【解决方案2】:

    这个名字似乎不起作用。无论我最终需要根列表的实际 ID,然后是所有后续文件夹,我都可以使用 ViewField 文件夹标签

    【讨论】:

      猜你喜欢
      • 2011-01-05
      • 2011-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-07
      相关资源
      最近更新 更多