Can I get the list's count?

Oct 21, 2013 at 3:37 PM
Edited Oct 21, 2013 at 3:38 PM
I want only to get the number of the items in the list without anything of item,what should I do ?
Thinks.
Coordinator
Oct 21, 2013 at 3:42 PM
You can call GetList and grab the value of the ItemCount attribute.

M.
Nov 7, 2013 at 6:31 PM
I've been trying to get the ItemCount as well and I'm running into several issues. I'm using the 2013.01 release along with jQuery 1.9.1.

What I find strange is that responseXML is undefined but I have all the XML text in responseText. No matter what i try, rs:data, z:row, etc. I get undefined and/or NaN. I've searched and searched and tried all the standard solutions.

If I debug my code, I can clearly see:

<?xml version="1.0" encoding="utf-8"?><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><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
 xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
 xmlns:rs='urn:schemas-microsoft-com:rowset'
 xmlns:z='#RowsetSchema'>
<rs:data ItemCount="11">
<z:row ows_Key='chance-4cb1d86d-c9fe-4275-a566-9feff412ab43' ows_Docum......

So I know I'm getting data back. I just can't get the value ItemCount. Anything else I can try?

Thanks
Coordinator
Nov 7, 2013 at 6:45 PM
As noted on the home page here, jQuery 1.9.x don't work with SPServices. Both of those version have bugs. Switch to 1.10.2.

You're calling GetListItems rather than GetList. If you call GetList, you don't need to pull back all of the items to know how many there are.

M.
Nov 8, 2013 at 10:11 AM
Thanks Marc. I did not notice that on the home page; I was too focused on the errors. Looking at it now, I don't know how I missed it.