0

I'm using SPServices to run a GetListItems query on a particular document library. This is in implementing a custom metadata-driven search for lists/libraries. In cases when the document library contains folders, the results are typically including the folder, but none of the items underneath of that folder, e.g.:

 <z:row ows_Title='My Nifty Subfolder' ows_LinkFilename='My Nifty Subfolder' ows_Author='23;#Bob Smith' ows_Modified='2015-02-05 09:32:42' ows_ContentType='Folder' ows_Created='2015-02-05 09:32:42' />

Is there some special CAML incantation that is needed to make the result include files within subfolders? At present, I am already using a CAMLQuery that looks like this, so if I'm making an error here, feedback is appreciated:

<Where>
  <Or>
   <Contains><FieldRef Name='ows_Title'/><Value Type='Text'>my search term here</Value></Contains>
  <Or>
   <Contains><FieldRef Name='ows_LinkFilename'/><Value Type='Text'>my search term here</Value></Contains>
  <Or>
   <Contains><FieldRef Name='ows_Description1'/><Value Type='Text'>my search term here</Value></Contains>
  <Or>
   <Contains><FieldRef Name='ows_Team'/><Value Type='Text'>my search term here</Value></Contains>
  <Or>
   <Contains><FieldRef Name='ows_Editor'/><Value Type='Text'>my search term here</Value></Contains>
   <Contains><FieldRef Name='ows_Keywords'/><Value Type='Text'>my search term here</Value></Contains>
  </Or></Or></Or></Or></Or></Where>

I'm also aware that this deeply nested <Or> construct is ugly, but experimentation and other questions have generally indicated that <Or> only takes two arguments, so I don't know of another way to express this.

2

Yes you need to place following query option

CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope="Recursive"/></QueryOptions>"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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