SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to dynamically get the names of all the lists in my site using a content query web part, but apparently a CQWB can only retrieve the items in the list, but not the list name? I'm wondering how can i go this, maybe using jquery? Thank you very much for your help!!!

share|improve this question

GetListCollection in Lists.asmx will get this for you.

Not yet sure if SPServices has implemented this, if not - give @sympmarc a shout on Twitter and suggest it to him :)

share|improve this answer
SPServices currently does not have a wrapper for GetListCollection according to the documentation. – Eric Alexander Aug 1 '12 at 18:21
Just checked -… - apparently it does? I'll let Marc add more info. – James Love Aug 1 '12 at 18:22
herpaderp, there just aren't any example pages of it being used. – Eric Alexander Aug 1 '12 at 18:24
GetListCollection has been there since way back in v0.2.3. Forever! – Marc D Anderson Aug 1 '12 at 19:17

+1 @james

Here's the documentation to the SPServices library.

There isn't an example on there, but I'll post one here:

        operation: "GetListCollection", 
        completefunc: function( xData, Status ) {
            console.log( Status );
            console.log( xData.responseText );

            $( xData.responseXML ).find("Lists > List").each(function() {
                var $node = $(this);

                console.log( $node.attr("Title") );

Hope this helps!

share|improve this answer
I was wondering if it can list out all the items inside the List and their types. (refer to qns -… – Jack Aug 27 '12 at 5:14

Another option is to use the JavaScript Client Object Model:


    var clientContext = new SP.ClientContext.get_current();
    var web = clientContext.get_web();
    var lists = web.get_lists();
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onListsQuerySucceeded), Function.createDelegate(this, this.onListsQueryFailed));

    function onListsQuerySucceeded() {
        var listEnumerator = lists.getEnumerator();
        while (listEnumerator.moveNext()) {
            var oList = listEnumerator.get_current();
            //Do something with oList.

    function onListsQueryFailed(sender,args) {
        alert("Failed: "+ args.get_message());      }
share|improve this answer

Your Answer


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.