Skip to content

Latest commit

 

History

History
169 lines (125 loc) · 4.38 KB

File metadata and controls

169 lines (125 loc) · 4.38 KB
author swapnil1993
title Update contentType
description Update a content type.
ms.localizationpriority medium
doc_type apiPageType
ms.subservice sharepoint
ms.date 04/04/2024

Update contentType

Namespace: microsoft.graph

Update a content type.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

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"
		}]
	}
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


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"
    }
}