Posts

Showing posts with the label Content Type

Get All content types from ContentTypeHub using SharePoint Rest API v2 using JavaScript

Why get the content type from Content Type Hub(CTH )? Content Type Hub is a centralized location where we manage and publish content types to other web applications. Content Type Hub is actually a Site Collection.  "In simple words, it is one place where you get to manage all the content type present in a tenant." To get all the Content Type from ContentTypeHub using REST API V2.* becomes easy now. It involves only the following two steps: Get the site ID of the ContentTypeHub https:// {YourtenantURL} /sites/contentTypeHub/_api/site Get all content types https:// {YourtenantURL} /_api/v2.1/sites/ {siteID of ContentTypeHub} /contentTypes Step 1: I am g etting the site ID of the ContentTypeHub by calling the REST API. As this is still from V1.0 endpoint, after  '/api'  , there is no need to mention the endpoint version.  In the success method, I am calling the method  getAllContentTypes  which will get the content types. var  siteURL=_spPageContextInfo.s...