Recursos para Profesionales de TI > Página principal de foros > SharePoint - Development and Programming > Listing Folders and Subfolders in Sharepoint using Lists Web Service
Formular una preguntaFormular una pregunta
 

RespondidaListing Folders and Subfolders in Sharepoint using Lists Web Service

  • jueves, 02 de julio de 2009 15:22Olorin.Maiar Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    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

Respuestas

Todas las respuestas