I am searching my list but the list is in folders. How can I use a query to ignore the folders and get the whole list so I can search it. I am using sharepoint 2013 and javascript. I want to get all items that are in all folders. None of the folders I have tried this:

Scope='RecursiveAll' /></QueryOptions><Query><Where><And><IsNotNull>
<FieldRef Name='ID' /></IsNotNull><Eq>
<FieldRef Name='ContentType' /><Value Type='Text'>Folder</Value></Eq></And></Where>
  • Are you getting folders as search results? Or you meant to search within a specific folder? Please share what you have done so far. Oct 15, 2014 at 14:45
  • I want all items in all of the folders
    – jimmywhizz
    Oct 15, 2014 at 14:56
  • 1
    <Eq><FieldRef Name='ContentType' /><Value Type='Text'>Folder</Value></Eq> This means you are searching Folder content type items. Thus it will not bring Document content type items. Remove the above <Eq> condition and try.. Oct 15, 2014 at 15:18
  • Nope didn't work
    – jimmywhizz
    Oct 15, 2014 at 15:19
  • Try where FSObjType=1?
    – wjervis
    Oct 15, 2014 at 15:29

1 Answer 1


You could just use SP.CamlQuery.createAllItemsQuery() as the parameter for getItems() although simply setting the scope to 'RecursiveAll' and inserting the filter that wjervis suggests should also do the trick.

Example of my proposal:


You can inspect exactly what this does in your browser dev tools if you're interested:

>var query = SP.CamlQuery.createAllItemsQuery()
"<View Scope="RecursiveAll">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.