Update contentType

Namespace: microsoft.graph

Update a content type.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Sites.Manage.All Sites.FullControl.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application Sites.Manage.All Sites.FullControl.All

HTTP request

PATCH /sites/{site-id}/contentTypes/{contentType-id}
PATCH /sites/{site-id}/lists/{list-id}/contentTypes/{contentType-id}

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the contentType resource to update.

Response

If successful, this method returns a 200 OK response code and an updated contentType object in the response body.

Example

Request

PATCH https://graph.microsoft.com/v1.0/sites/{site-id}/contentTypes/{contentType-id}
Content-Type: application/json

{
    "name": "updatedCt",
	"documentSet": {
		"shouldPrefixNameToFile": true,
		"allowedContentTypes": [{
			"id": "0x0101",
			"name": "Document"
		}],
		"defaultContents": [{
				"fileName": "a.txt",
				"contentType": {
					"id": "0x0101"
				}
			},
			{
				"fileName": "b.txt",
				"contentType": {
					"id": "0x0101"
				}
			}
		],
		"sharedColumns": [{
				"name": "Description",
				"id": "cbb92da4-fd46-4c7d-af6c-3128c2a5576e"
			},
			{
				"name": "Address",
				"id": "fc2e188e-ba91-48c9-9dd3-16431afddd50"
			}
		],
		"welcomePageColumns": [{
			"name": "Address",
			"id": "fc2e188e-ba91-48c9-9dd3-16431afddd50"
		}]
	}
}

Response

HTTP/1.1 200 OK
Content-type: application/json

{
    "id": "0x0101009B237E76EF94DC49B4E58139041E7C60",
    "description": "",
    "eTag": "\"7\"",
    "group": "Custom Content Types",
    "hidden": false,
    "name": "testdoc",
    "parentId": "0x0101",
    "base": {
        "id": "0x0101",
        "name": "Document"
    }
}