0

This is my Code to get Lists by url:

this.getListsOfWebByUrl = function (Url) {
        var clientContext = new SP.ClientContext(Url);
        var oWebsite = clientContext.get_web();
        var collList = oWebsite.get_lists();

        clientContext.load(collList, 'Include(Title , Id)');
        clientContext.executeQueryAsync(function onSucc(sender, args) {
            var listInfo = new Object();
            listInfo.title = new Array();
            listInfo.id = new Array();
            listInfo.url = new Array();
            listInfoCollection = collList.getEnumerator();
            while (listInfoCollection.moveNext()){
                var oList = listInfoCollection.get_current();
                listInfo.title.push(oList.get_title());
                listInfo.id.push(oList.get_id()._m_guidString$p$0);
                listInfo.url.push(collList.get_item('url'));
            }
            return listInfo;
        }, function onFail(sender, args) {
            alert("request Failed: " + args.get_message() + "\n" + args.get_stackTrace());
        });

    }

now I want to do the same but with webId instead of url , But I have no Idea on how to do this . Thanks for your help

1
  • the 2 search words that gets you a massive load of Documentation are Enumerate and SPWeb Commented Jan 11, 2017 at 14:11

1 Answer 1

0

Try following, I hope ClientContext accept Web id as parameter.

var guid = "00000-00000-00000-00000-00000-00000"
var clientContext = new SP.ClientContext(guid);
1
  • This didn't work for me.
    – M. Lanza
    Commented Sep 27, 2019 at 13:59

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.