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.Security;
var requestBody = new CategoryTemplate
{
OdataType = "#microsoft.graph.security.categoryTemplate",
DisplayName = "Accounts Payable",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Labels.Categories.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"
graphmodelssecurity "github.com/microsoftgraph/msgraph-sdk-go/models/security"
//other-imports
)
requestBody := graphmodelssecurity.NewCategoryTemplate()
displayName := "Accounts Payable"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
categories, err := graphClient.Security().Labels().Categories().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.security.CategoryTemplate categoryTemplate = new com.microsoft.graph.models.security.CategoryTemplate();
categoryTemplate.setOdataType("#microsoft.graph.security.categoryTemplate");
categoryTemplate.setDisplayName("Accounts Payable");
com.microsoft.graph.models.security.CategoryTemplate result = graphClient.security().labels().categories().post(categoryTemplate);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Security\CategoryTemplate;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CategoryTemplate();
$requestBody->setOdataType('#microsoft.graph.security.categoryTemplate');
$requestBody->setDisplayName('Accounts Payable');
$result = $graphServiceClient->security()->labels()->categories()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.security.category_template import CategoryTemplate
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CategoryTemplate(
odata_type = "#microsoft.graph.security.categoryTemplate",
display_name = "Accounts Payable",
)
result = await graph_client.security.labels.categories.post(request_body)