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

I am currently making a call to GetListItems and I'm curious if there is any way to both page results and get the total number of records available?

Here is what I am passing in my call to lists.asmx:

var xmlData = "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
                       "<soap:Body>" +
                        "<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
                            "<listName>Planning Road Names</listName>" +
                            "<query>" +
                                "<Query xmlns=''>" +
                                    "<OrderBy>" +
                                        "<FieldRef Name='Title' />" +
                                    "</OrderBy>" +
                                "</Query>" +
                            "</query>" +
                            "<viewFields>" +
                                "<ViewFields xmlns=''  />" +
                            "</viewFields>" +
                            "<queryOptions>" +
                                "<QueryOptions xmlns='' />" +
                            "</queryOptions>" +
                        "</GetListItems>" +
                      "</soap:Body>" +
                    "</soap:Envelope>";

I looked on the documentation page and it sounds like the web service will automatically page the results for you:

Paging - A string that contains data needed to support paging, including a ListItemCollectionPositionNext attribute. If left empty, the list items returned start from the beginning of the list. Client applications should supply the value of a server-supplied bookmark. The server returns the next page of data based on the bookmark supplied. This element is optional, and its default value is an empty string.

But I can't find a way to get the total number of records available. Can this be done?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

This question has been repeated several times at several places and the answer is there is no straightforward way to figure out how many total records are available and hence figure out how many pages in total. the most educated guess is that this is due to performance reasons.

Check out this thread (I am sure you can find many others): http://stackoverflow.com/questions/4031998/determine-total-count-of-items-returned-by-spquery

share|improve this answer

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.