Wednesday, September 30, 2009

SPQuery returning no result

Scenario:
One common scenario with SPQuery object is that it returns zero results.
OR
It does return something in DEV but not into PRODUCTION.
OR
Its giving results for Site Collection Administrator but not for some users.

Also you need to recompile\deploy the code if you want to do some trial error with SPQuery's query property value... which can be painful.

Solution:
One of things which can be used is Content and Structure report without recompiling the SPQuery object.

Steps:
Steps for one of the sample report is here
All Checked Out Documents Query Test

Now you can edit the CAML as many times as you want and test the results. Great thing about this is without any code you can test your CAML Query in PRODUCTION.

0 comments: