Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
// 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://video2.skills-academy.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 $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-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://video2.skills-academy.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 import GraphServiceClient
from msgraph.generated.models.content_type import ContentType
# To initialize your graph_client, see https://video2.skills-academy.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)