SP.ContentTypeCollection.getById Method (sp.js)

Returns the content type with the specified ID from the collection.

Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

SP.ContentTypeCollection.getById()

Parameters

  • contentTypeId
    A string that contains the content type ID. It must not be null. It must conform to the following ABNF:

    nonzero-digit = "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"

    digit = "0" / nonzero-digit

    nonzero-hexdigit = nonzero-digit / "A" / "B" / "C" / "D" / "E" / "F"

    hexdigit = "0" / nonzero-hexdigit

    id = *(nonzero-hexdigit hexdigit / "0" nonzero-hexdigit)

    parentids = *(16(hexdigit hexdigit))

    contentTypeId = id [ "00" parentids].

Return value

Type: SP.ContentType

Remarks

If a content type with the given identifier is not found in the collection, the server must return null.

REST resource endpoint

Endpoint URI structure

http://<sitecollection>/<site>/_api/web/lists(listid)/contenttypes/getById(contentTypeId)

HTTP requests

This resource supports the following HTTP commands:

  • POST

POST syntax

POST http://<sitecollection>/<site>/_api/web/lists(listid)/contenttypes/getById(contentTypeId)

Resource parameters

  • contentTypeId