I am site administrator for one of the SharePoint site and trying to get all the lists name of SharePoint 2013 site using JSOM and Html. And i had created 2 files one html and other js file in Site Assets,And linked the html file location in CEWP but found no luck can any one help me in knowing what went wrong in my code


 <meta charset="utf-8" />
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="../Shared Documents/GetRestitems.js"></script>

<div id="divhelloworld">You Will Get the Data</div>


JS Code


   function getListData() {
var clientContext = new SP.ClientContext();
var oWebsite = clientContext.get_web();
this.collList = oWebsite.get_lists();
           Function.createDelegate(this, this.onQuerySucceeded),
           Function.createDelegate(this, this.onQueryFailed)

function onQuerySucceeded() {
var listInfo = '';
var listEnumerator = collList.getEnumerator();
          while (listEnumerator.moveNext()) {
          var oList = listEnumerator.get_current();
          listInfo += 'Title: ' + oList.get_title() + ' - Created: ' +
          oList.get_created().toString() + '<br />';

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

  • Getting any errors in browser console? – Jussi Palo Mar 1 '16 at 12:05
  • Good way to develop any front-end stuff is to develop in Chrome Snippets: github.com/bgrins/devtools-snippets It does not require any installation of software. Because your page has loaded no need for Ready functions, you can focus on the code. Once you have the JSOM code working place it onto SP pages in a CEWP or JSLink. – Danny '365CSI' Engelman Mar 1 '16 at 12:15
  • Dear Danny / Jussi, Thanks for blaze response.I am linking the html page in content editor web-part as described,But found no luck – MSA Mar 1 '16 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.