Get SharePoint list properies by JavaScript

17/12/2015 04:18

function getListProperties() {

 SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {
  //load site
    var currentcontext = new SP.ClientContext.get_current();
    list = currentcontext.get_web().get_lists().getByTitle('TestSurveyRegion');
    listRootFolder= list.get_rootFolder();

     currentcontext.load(list, 'Title', 'Id');
     currentcontext.load(listRootFolder);
     currentcontext.executeQueryAsync(Function.createDelegate(this, result), Function.createDelegate(this, oncListQueryFailed));
     });

  
 }

 function result() {
 var listID = list.get_id();
     var listName= list.get_title();
 var listURL = listRootFolder.get_serverRelativeUrl();
 alert(listID + listName + listURL);
 }

 function oncListQueryFailed(sender, args) {
     alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
     }
 
getListProperties();