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.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new ContentType
{
Name = "docSet",
Description = "custom docset",
Base = new ContentType
{
Name = "Document Set",
Id = "0x0120D520",
},
Group = "Document Set Content Types",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Sites["{site-id}"].ContentTypes.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ContentType contentType = new ContentType();
contentType.setName("docSet");
contentType.setDescription("custom docset");
ContentType base = new ContentType();
base.setName("Document Set");
base.setId("0x0120D520");
contentType.setBase(base);
contentType.setGroup("Document Set Content Types");
ContentType result = graphClient.sites().bySiteId("{site-id}").contentTypes().post(contentType);
from msgraph import GraphServiceClient
from msgraph.generated.models.content_type import ContentType
graph_client = GraphServiceClient(credentials, scopes)
request_body = ContentType(
name = "docSet",
description = "custom docset",
base = ContentType(
name = "Document Set",
id = "0x0120D520",
),
group = "Document Set Content Types",
)
result = await graph_client.sites.by_site_id('site-id').content_types.post(request_body)
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.