Skip to content

Instantly share code, notes, and snippets.

@goyuix
Last active September 8, 2015 19:10
Show Gist options
  • Save goyuix/3cea7b368ed488ad011b to your computer and use it in GitHub Desktop.
Save goyuix/3cea7b368ed488ad011b to your computer and use it in GitHub Desktop.
jQuery.ajax({
url: "/_api/web/webs?$expand=Lists",
headers: { accept: "application/json;odata=verbose"}
}).done(function(json){
var i=0, j=0, html=[], web=null, list=null;
html.push('<table><tr><th>Web</th><th>Library</th><th>Description</th></tr>')
for (;i<json.d.results.length;i++){
web = json.d.results[i];
for (;j<web.Lists.results.length;j++){
list = web.Lists.results[j];
// filter for only visible, document libraries
if (!list.Hidden && list.BaseType===1) {
html.push('<tr><td>'+web.Title+'</td><td>'+list.Title+'</td><td>'+list.Description+'</td></tr>');
}
}
}
html.push('</table>');
// place the generated table on the page somewhere in a div with the id of LibrarySummary
jQuery("#LibrarySummary").html(html.join(''));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment