0

I'm creating an iOS app that queries a Sharepoint Webservice with GetListItems. I'm able to retrieve all of the records, but there are a lot of records > 4000. Is there a way I can retrieve 50 at a time?

I'm using SOAP for this by the way.

Choppin Broccoli
  • 3,048
  • 2
  • 21
  • 28

1 Answers1

0

Assuming you're passing a CAML query to the webservice, you ca use a rowlimit tag

<Query>
   <!-- your current query here -->
   <RowLimit>100</RowLimit>
</Query>

EDIT

To retrieve a subset of values you could do something like this

<Query>
   <Where>
     <And>
       <Geq>
         <FieldRef Name='ID'/>
         <Value Type='Counter'>0</Value>
       </Geq>
       <Lt>
         <FieldRef Name='ID'/>
         <Value Type='Counter'>100</Value>
       </Lt>
     </And>
   </Where>
</Query>

I haven't tested this, but it should work. Of course, you're going to want to change the values in your code to retrieve the particular subset.

Robbert
  • 6,481
  • 5
  • 35
  • 61
  • True, but then how do I get the next 100 rows? – Choppin Broccoli Aug 28 '13 at 23:24
  • I dont think there's a way to do that with CAML. One way you could do this is to limit the returned rows by using a where statement returning rows based on the row ID. Something like where ID >= 0 and ID < 100. Next time, you get ID >= 100 and ID < 200. You may not get exactly 10 rows each time, but you'll get them all eventually. Obviously, you'd need to write it in CAML. – Robbert Aug 29 '13 at 04:00
  • Would you mind showing me how to do this like your code above? – Choppin Broccoli Aug 29 '13 at 16:55
  • Hmmmm.. doesn't seem to work. I always get the first 30 values no matter what I set the counters to (30 is the default number of values on a page) – Choppin Broccoli Aug 29 '13 at 20:26
  • If you set the query to look for number 200 to 300, do you still only get the first 30 (numbers 1 to 31), or do you get 200 to 230? – Robbert Aug 29 '13 at 21:25
  • Now I get errors. I read that you have to wrap it in a (note the lowercase q). These are soap calls btw. The error I get is a SoapServerException – Choppin Broccoli Aug 29 '13 at 21:46
  • Figured it out. It should be Value Type and not Value type (case sensitive). Do you know where I can find documentation on this? I find I'm guessing half the time – Choppin Broccoli Aug 29 '13 at 22:36
  • SharePoint caml is confusing. There used to be a really good website that laid out how to create queries and had very good samples. I cannot find it anymore, but there's one at MSDN: http://msdn.microsoft.com/en-us/library/sharepoint/ms467521.aspx that's pretty thorough. Here's another with some samples: http://sharepoint-works.blogspot.com/2012/05/caml-query-tutorial-for-sharepoint.html. In this regard, Google is your friend. Don't forget to mark this as an answer if you found it answered your problem. – Robbert Aug 29 '13 at 22:52