JSOM: Get Content Types for SharePoint Web

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 +

One thought on “JSOM: Get Content Types for SharePoint Web

  1. moni Reply

    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..
    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.executeQueryAsync(Function.createDelegate(this, function () { success(items1, _resultStr)); }), Function.createDelegate(this, function (sender, args) { deferred.reject(sender, args); }));
    tableFormate = tableFormate + _resultStr;



Leave a Reply

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