Tuesday, June 23, 2009

GetListItems only returns 100 items

When using the SharePoint webservice lists.asmx you can create a simple CAML query to retrieve listitems. I discovered that when no RowLimit is set the result does not return more than 100 items. So if you want to retrieve more than 100 items be sure to specify the RowLimit when calling GetListItems.

The example below is in Delphi code:

GetListItems

The code above will return all items using a max limit of 5000 items. The code below will only return 100 items regardless of the “real” amount of list items specified.

GetListItems_1

Monday, June 15, 2009

Do not forget the <Query> in your Queries

When programming using the SharePoint WebServices you often want to write a CAML query to select items from a list etc.

When developing using the SharePoint API you do not need to write the surrounding <Query> tags. But when you submit a query to a webservice ex: lists.asmx the tags must be present.

Without the query tags the response will contain a soap exception.

It took me a while figuring this out as I was copying some C# code from an evenhandler to select items, into a Delphi app consuming the Lists webservice.

query