javascript - sp.js get all lists by content type -
i have combed through sp namespace docs , not found go on.
i found snippet http://www.c-sharpcorner.com/blogs/12134/how-to-get-the-list-content-types-using-csom-in-sharepoint-2.aspx
//// string variable store siteurl string siteurl = "http://c4968397007/"; //// context sharepoint site access data clientcontext clientcontext = new clientcontext(siteurl); //// content type collection list "custom" contenttypecollection contenttypecoll = clientcontext.web.lists.getbytitle("custom").contenttypes; clientcontext.load(contenttypecoll); clientcontext.executequery(); //// display content type name foreach (contenttype ct in contenttypecoll) { console.writeline(ct.name); } console.readline();
which a lists content type.
my thought lists, content types, use id/title query lists data.
seems ton of work in display template.
am on right path or there i'm missing? sp wiz out there care weight in on new search/js architecture?
you may want use javascript library sharepointplus or popular spservices.
i think syntax of sharepointplus simplier , code like:
$sp().lists(function(list) { (var i=0; i<list.length; i++) { // list[i]['name'] contains name of list $sp().list(list[i]['name']).get(/* */) } });
you said content types. may want @ the info()
function , check field name "contenttypeid".
fyi created sharepointplus library.
Comments
Post a Comment