Sharepoint - Get Items Under Folder CAML

i managed to get it working .

i changed the scope from "Recursive" to "RecursiveAll", RecursiveAll gets all files and all folders under the specidified location.

Caml query was replaced with

    camlQuery.ViewXml = "<View Scope=\"RecursiveAll\"> " +
                    "<Query>" +
                    "<Where>" +
                                "<Eq>" +
                                    "<FieldRef Name=\"FileDirRef\" />" +
                                    "<Value Type=\"Text\">/ecm/Business/Business/Projects/IDECO_P01030000</Value>" +
                                 "</Eq>" +
                    "</Where>" +
                    "</Query>" +
                    "</View>";

Try setting the FolderServerRelativeUrl property of the CamlQuery. See: here


you should also try to load all the folders and files. means

 clientContext.Load(DocumentList);
 clientContext.Load(DocumentList.RootFolder);
 clientContext.Load(DocumentList.RootFolder.Folders);
 clientContext.Load(DocumentList.RootFolder.Files); 
 clientContext.Load(listItems);
 clientContext.ExecuteQuery();

than you can get FolderCollection in Library

 FolderCollection FC = Document.RootFolder.Folders
 Foreach(Folder Fl in FC)
         {
                FileCollection flc = fl.files;
         } 

Hops its help.

Tags: