I'm a Sharepoint App beginner. I have a SharePoint 2013 App that provisions List. How can I get the GUID of those list using CSOM and JavaScript?

Here's what I got so far:

    var lists;

    function getLists()
        var context = SP.ClientContext.get_current();
        var web = context.get_web();
        context.load(web, "Title", "Description");
        lists = web.get_lists();
        context.load(lists, "Include(Id, Title, Hidden, ItemCount)");
        context.executeQueryAsync(onSuccess, onFail);

    function onSuccess() {
        var ul = $("#listsList");
        var listsEnum = lists.getEnumerator();
        while (listsEnum.moveNext())
            var list = listsEnum.get_current();
            if (list.get_hidden() == false )
                var title = list.get_title();
                var elem = $("<li>" + title + " with GUID " + list.id  + "</li>");
                ul.append(elem); // append the details to a list

    function onFail() {
        alert("Request failed");

The list.id is always undefined. How do I access the GUID property, or am I doing something else wrong?


1 Answer 1


Try list.get_id().toString(); instead of list.id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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