Basically we have two modifiers Recursive and All
If you don’t set the scope to All it will only bring files. If you don’t set it to recursive it will only retrieve items from the folder you are at. There are not that many variants so let’s make an example of each.
Let’s imagine we have a SharePoint folder like this one and we want to query it:
Just before we start, allow me to remind you that the scope is set in the property ViewAttributes of the SPQuery item.
To add a bit more of clarity I have also painted the levels:
The green line marks what’s inside the root folder, the blue line marks the contents of SubFolder1 and the red line SubFolder2.
ViewAttributes left by default:
This is just the files under the root folder.
ViewAttributes = "Scope='Recursive'"
This means all the files in all the folders.
ViewAttributes = "Scope='All'"
This scope will bring folders and files under root.
ViewAttributes = "Scope='RecursiveAll'"
And finally with RecursiveAll you can bring back everything under the root entity.
Good luck with your queries.
No comments:
Post a Comment