Zdroje informací pro profesionály v oboru IT > Domovská stránka fór > SharePoint - Development and Programming > Listing Folders and Subfolders in Sharepoint using Lists Web Service
Odeslat dotazOdeslat dotaz
 

OdpovědětListing Folders and Subfolders in Sharepoint using Lists Web Service

  • 2. července 2009 15:22Olorin.Maiar Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    Hi,

    I am using Sharepoint Lists Web Service to retrieve a list of folders within a Document Library. I use the following code:

    XmlDocument xmlDoc = new
     System.Xml.XmlDocument();
    XmlNode spViewFields = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields"
    , ""
    );
    XmlNode queryOption = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions"
    , ""
    );
    XmlNode spQuery = xmlDoc.CreateNode(XmlNodeType.Element, "Query"
    , ""
    );
    
    spQuery.InnerXml = "<Where><Contains><FieldRef Name=\"
    FileRef\"/><Value Type=\"
    Text\">Docuemnt Library</Value></Contains></Where>"
    ;
    
    XmlNode ndListItems = spListsService.GetListItems("Document Library"
    , null
    , spQuery, spViewFields, null
    , queryOption);
    XmlNodeList oNodes = ndListItems.ChildNodes;
    

    However, this only returns folders within Document Library and not the Sub Folders. Is there a way to list the Sub Folders without calling the same code block recursively (using queryOptions.InnerText = <Folder>Document Library/SubFolderName</Folder>

    Olorin

Odpovědi

Všechny reakce