V_B
V_B

Reputation: 1569

get all document from all folder and subfolder from document library sharepoint 2010

I want to retrieve all documents from folder to it's subfolder and so on using client object model.Please help me.

Upvotes: 0

Views: 6537

Answers (1)

V_B
V_B

Reputation: 1569

I found my solution

 ClientContext clientContext =
    new ClientContext("http://Servername/");
    List sharedDocumentsList = clientContext.Web.Lists.GetByTitle("Shared Documents");
    CamlQuery camlQuery = new CamlQuery();
   camlQuery.ViewXml = @"<View Scope='Recursive'><Query><Where><Eq><FieldRef Name='FSObjType' /><Value Type='Lookup'>0</Value></Eq></Where></Query></View>"


    ClientOM.ListItemCollection listItems =
        sharedDocumentsList.GetItems(camlQuery);
    clientContext.Load(listItems);
    clientContext.ExecuteQuery();
    foreach (var item in listItems)
    {
       // get all document here
    }

Upvotes: 3

Related Questions