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.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
RecordsManagement.ReadWrite.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
RecordsManagement.ReadWrite.All
Not available.
HTTP request
POST /security/labels/categories/{categoryTemplateId}/subcategories
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models.Security;
var requestBody = new SubcategoryTemplate
{
OdataType = "#microsoft.graph.security.subcategoryTemplate",
DisplayName = "Vendor Invoice",
};
// 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["{categoryTemplate-id}"].Subcategories.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.NewSubcategoryTemplate()
displayName := "Vendor Invoice"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
subcategories, err := graphClient.Security().Labels().Categories().ByCategoryTemplateId("categoryTemplate-id").Subcategories().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.SubcategoryTemplate subcategoryTemplate = new com.microsoft.graph.models.security.SubcategoryTemplate();
subcategoryTemplate.setOdataType("#microsoft.graph.security.subcategoryTemplate");
subcategoryTemplate.setDisplayName("Vendor Invoice");
com.microsoft.graph.models.security.SubcategoryTemplate result = graphClient.security().labels().categories().byCategoryTemplateId("{categoryTemplate-id}").subcategories().post(subcategoryTemplate);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Security\SubcategoryTemplate;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SubcategoryTemplate();
$requestBody->setOdataType('#microsoft.graph.security.subcategoryTemplate');
$requestBody->setDisplayName('Vendor Invoice');
$result = $graphServiceClient->security()->labels()->categories()->byCategoryTemplateId('categoryTemplate-id')->subcategories()->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.subcategory_template import SubcategoryTemplate
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = SubcategoryTemplate(
odata_type = "#microsoft.graph.security.subcategoryTemplate",
display_name = "Vendor Invoice",
)
result = await graph_client.security.labels.categories.by_category_template_id('categoryTemplate-id').subcategories.post(request_body)