GetListItems only returns 100 items

Introduction:

In this article I will describe that why GetListItems only returns 100 items..

This will use below terms:-
1. GetListItems: its a sharepoint webservice method.
2. lists.asmx: its a sharepoint webservice.

Issue:

When we use SharePoint list.asmx webservice method GetListItems; then it only return 100 item by default.

Solution:

I learned that when no RowLimit is set; the webservice only returns 100 items. So if you want to retrieve more than 100 items then you need to specify the RowLimit during webservice call.

Below is the sample of code-

Sample code 1

1
myWebService.GetListItems(strListGuid, strViewId, strXmlQuery, null, ‘5000’, ‘’)

Sample code 2

If you are sending full xml SOAP request then add below query

1
2
3
4
5
6
7
8
9
10
11
12
13
   request = "<?xml version='1.0' encoding='utf-8'?>" + _
   "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + _
   " xmlns:xsd='http://www.w3.org/2001/XMLSchema'" + _
   " xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" + _
   " <soap:Body>" + _
   " <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" + _
   " <listName>" & list & "</listName>" + _
   " <viewName>" & view & "</viewName>" + _
   " <ViewFields>" & viewFields & "</ViewFields>" + _
   " <rowLimit>5000</rowLimit>" + _
   " </GetListItems>" + _
   " </soap:Body>" + _
   "</soap:Envelope>"

Hope it helps.
Thanks!
Avinash

calendarJune 16, 2014 · cardInfoyen · commentsNo Comments
tagPosted in: SharePoint, Web Service

Leave a Reply

Spam Protection: , required

myworldmaps infoyen