I have a custom Site page that contains some javascript code (using jquery and SPServices
), that calls Lists.asmx
Web service to perform CRUD operations on the list. At the init, my js code needs all list items. Recently I notided, that the latest added list items are not returned. Using Fiddler, I investigated that they are not simply included in the result set.
As older items seem to be useless for my code, there's a simply solution just to clear them.
But the question still remains, if the Lists.asmx
has any limit of the items to return, and if it has how to configure it.
Thx in advance.
2 Answers
I assume you're using Lists.GetListItems to get the list items.
In the call the rowLimit
specifies how may items you maximum want returned. If it's not specified, then the rowLimit is taken from the view with the Id specified in viewName
, if that isn't specified then from the default view.
The query
parameter can be used to limit the selection based on a CAML query (see the answer from @JohnChapman) and can also specify the order, so you get the newest items first.
You need to specify the number of results in the CAML query sent to the Lists web service. SharePoint Magazine had a good article about using CAML queries against the web service: http://sharepointmagazine.net/articles/writing-caml-queries-for-retrieving-list-items-from-a-sharepoint-list. In addition, the MSDN documentation on the CAML query schema might be helpful for you: http://msdn.microsoft.com/en-us/library/ms467521.aspx.