Welcome to MSDN Blogs Sign in | Join | Help

SharePoint: How to retrieve the list of item from the Sub folders by using Lists.asmx web service

Unfortunately SPS SDK doesn’t provide sample to get the details from the subfolder. I have compiled a sample code snippet to achieve it. Here you go for the code.

 

            localhost.Lists listService = new localhost.Lists();

            listService.Credentials = System.Net.CredentialCache.DefaultCredentials;

            //url and folder name hard coded - modify it as per your requirement.

            listService.Url = "http://karthickmain:9090/sites/a1/_vti_bin/lists.asmx";

 

            XmlDocument xmlDoc = new System.Xml.XmlDocument();

            //Create query options node

            XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element,"QueryOptions","");

            //Specify the folder name

            ndQueryOptions.InnerXml = "<Folder>SourceDL/Folder1</Folder>";

 

            //get the items

            XmlNode ndListItems = listService.GetListItems("SourceDL", null, null, null, null, ndQueryOptions);

            //display the node

            MessageBox.Show(ndListItems.OuterXml);

Published Monday, March 27, 2006 8:18 PM by Karthikeyan
Filed under:

Comments

# re: SharePoint: How to retrieve the list of item from the Sub folders by using Lists.asmx web service

Tuesday, September 11, 2007 7:41 AM by berndowling

Hi,

Is SourceDL a folder as well or the name of your document library.

"<Folder>SourceDL/Folder1</Folder>";

I've tried the code out - I'm using WSS v3 and I get this error.

The request failed with the error message: -- <head><title>Document Moved</title></head> <body><h1>Object Moved</h1>This document may be found <a HREF="http://Server/default.aspx">here</a></body> --.</anyType>

Thanks for the help

Anonymous comments are disabled
 
Page view tracker