gcoleman0828
gcoleman0828

Reputation: 1542

SharePoint Webservices GetLists

I am having major issues trying to get to documents in subfolders of the Document Library of a particular site using Lists.asmx that hooks into the site. I am able to pass the GUID for the Document Library and get the list of folders and files under it, but I am unable to get the files within the folders underneath the Document Library.

Here is some of my code:

 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);

I keep looking inside ndListItems and I am only seeing the folders, not what is inside them. I also tried using the GUID for the folder I want to see inside of and it fails with the error:

List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. 0x82000006

Any ideas?

Upvotes: 0

Views: 1176

Answers (2)

gcoleman0828
gcoleman0828

Reputation: 1542

The name doesn't seem to work. no matter what i end up needing the actual ID for the root list and then all subsequent folders I am able to use the ViewField Folder tag

Upvotes: 0

夏至夕陽
夏至夕陽

Reputation: 362

Try change the list name to "Document Library" with the space but not %20.

Upvotes: 1

Related Questions