Thursday, February 03, 2011

SPQuery related

An interesting thing to note about SPList.GetItems and SPQuery is that by default, SPList.GetItems will return you results in only one folder of a given list. If indeed you wanted to recurse the folders in a given list and identify all items matching the given criterion, you need to add the following line to your code:

query.ViewAttributes = "Scope=\"Recursive\"";