Reputation: 561
I am trying to search for files/folders whose names start with the entered text say 'foo'. I am able to retrieve files but the subfolders are not returned. Can anyone help. This is the CAML I am currently using:
<View Scope='Recursive'>
<Query>
<Where>
<BeginsWith>
<FieldRef Name='FileLeafRef' />
<Value Type='Text'>foo</Value>
</BeginsWith>
</Where>
</Query>
</View>
Upvotes: 0
Views: 865
Reputation: 800
Try changing the scope to scope="RecursiveAll", this gets all files and all folders under the specified location. Also you should change:
<Value Type='Text'>foo</Value>
To
<Value Type='File'>foo</Value>
Also worth knowing is that FileLeafRef is the FILENAME (.docx etc) not the Title in SharePoint. Maybe you knew that :)
Upvotes: 1