Wednesday, 29 May 2013

SharePoint: CAML Query not working based on WHERE clause

When we write the CAML query in SharePoint development and if we put WHERE clause in query it still returns all records.


For example look at the below query, it works fine in U2U builder but returns all records if we use the same in code.


SPQuery query = new SPQuery();
query.Query = "<Query><Where></Where></Query>"


Here is the Fix:

Remove the "<Query>" Tag and rewrite it

SPQuery query = new SPQuery();
query.Query = "<Where></Where>"

1 comment:

SharePoint 2013: Video file URL from Asset Library

When you are working with Asset library in SharePoint 2013. It is very important to note that how video files are stored and managed in tha...