// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.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 major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewContentType()
name := "docSet"
requestBody.SetName(&name)
description := "custom docset"
requestBody.SetDescription(&description)
base := graphmodels.NewContentType()
name := "Document Set"
base.SetName(&name)
id := "0x0120D520"
base.SetId(&id)
requestBody.SetBase(base)
group := "Document Set Content Types"
requestBody.SetGroup(&group)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
contentTypes, err := graphClient.Sites().BySiteId("site-id").ContentTypes().Post(context.Background(), requestBody, nil)
// 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);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.content_type import ContentType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
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)