The Property “SP.Web.ContentTypes (SP.js)” used to return the collection for content types from the particular SharePoint Web. This means, the Site Content Types create under specific site. For more details, https://msdn.microsoft.com/en-us/library/office/jj245580.aspx

Below is the example snippet used to retrieve the collection of content types and display the Title & Id of each content type for the particular SharePoint website “http://sharepoint-site/subsite”.

Available in : SharePoint Online, SharePoint 2013 +

Categories: Code Snippet

1 Comment

moni · September 1, 2016 at 12:25 PM

plz help me for this type of code i want to retieve the data on by one in loop,but loop is running before getting any data from list..
for(i=0;i,48;i++)
{
var ctx = new SP.ClientContext(appWebUrl);
var appCtxSite = new SP.AppContextSite(ctx, hostWebUrl);
var web = appCtxSite.get_web(); //Get the Web
var list1 = web.get_lists().getByTitle(“MeetingRoomBooking”); //Get the List
var query = “”;
query = new SP.CamlQuery();
query.set_viewXml(“” + RoomID + “Submit”);
var items1 = list1.getItems(query);
ctx.load(list1);
ctx.load(items1);
ctx.executeQueryAsync(Function.createDelegate(this, function () { success(items1, _resultStr)); }), Function.createDelegate(this, function (sender, args) { deferred.reject(sender, args); }));
tableFormate = tableFormate + _resultStr;

};

}

Leave a Reply to moni Cancel reply

Your email address will not be published. Required fields are marked *