Tuesday, April 7, 2015

SharePoint list query is returning all items

To save time when querying lists in SharePoint, I create a view and then use SharePoint designer to get the CAML query for that view. This CAML can then be used programatically to query the list. An interesting feature I came across is that when the query tags <query> and </query> are left in the CAML, the query will always return all items in the list. To get the query to work correctly, simply remove the query tags and ensure the CAML begins with <where>.

No comments:

Post a Comment