Reputation: 1569
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
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