Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Pagination loses some of it's luster with no knowledge of the total number of results. Is it possible to perform a "row count" with either REST or SOAP (getListItems) without getting back all of the items (eg: a request truncated with $top)?

Ideally you would request /_vti_bin/listData.svc/myList?$top=2 and get back 2 results and a count of the total. Is there any at all to accomplish this is SP2010?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You can make a REST call like _vti_bin/Listdata.svc/YourList/$count and it should return the number of items in the list.

http://mstecharchitect.blogspot.com/2010/01/accessing-sharepoint-2010-lists-using.html

share|improve this answer
    
That is perfect. It's unfortunate that the total isn't attached to all REST calls d.__count but hey, at the cost of another call as least it's accessible. Thank you very much! –  Sinetheta Jan 4 '13 at 17:25
    
Bonus points if you can tell me where something like this would be documented? Silly me, I thought I'd find an API in the MSDN, but apparently scattering tidbits across the blogosphere is the MS version of developer relations. –  Sinetheta Jan 4 '13 at 18:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.