Last active
September 8, 2015 19:10
-
-
Save goyuix/3cea7b368ed488ad011b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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