APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Assign a sensitivity label to a plannerRoster object.
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)
Tasks.ReadWrite
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Tasks.ReadWrite.All
Not available.
HTTP request
POST /planner/rosters/{rosterId}/assignSensitivityLabel
The method that is used to apply the sensitivity label to the roster. Possible values are: standard, privileged, auto, unknownFutureValue.
sensitivityLabelId
String
The ID of the label that's applied to the roster.
Response
If successful, this method returns a 200 OK response code and a plannerRoster object in the response body.
This method fails in the following situations, each with a respective response code. The code property in the error response indicates the specific error.
Response code
Description
Code property value
400 Bad Request
If the label has sublabels, it can't be applied to the roster. Only labels without sublabels can be applied. The request fails.
sensitivityLabelHasSublabels
403 Forbidden
If labels are mandatory for the user and the user tries to remove the sensitivity label, the request fails.
sensitivityLabelsAreMandatory
403 Forbidden
If a previously existing label assignment was applied with sensitivityLabelAssignmentMethod.privileged and an app attempts to overwrite the label with sensitivityLabelAssignmentMethod.standard, the request fails.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Planner.Rosters.Item.AssignSensitivityLabel;
using Microsoft.Graph.Beta.Models;
var requestBody = new AssignSensitivityLabelPostRequestBody
{
AssignmentMethod = SensitivityLabelAssignmentMethod.Standard,
SensitivityLabelId = "7a4d7cc1-f72b-46a3-9831-02680eaf56f9",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Planner.Rosters["{plannerRoster-id}"].AssignSensitivityLabel.PostAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("If-Match", "\"W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"\"");
});
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphplanner "github.com/microsoftgraph/msgraph-beta-sdk-go/planner"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("If-Match", "\"W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"\"")
configuration := &graphplanner.PlannerRosterItemAssignSensitivityLabelRequestBuilderPostRequestConfiguration{
Headers: headers,
}
requestBody := graphplanner.NewAssignSensitivityLabelPostRequestBody()
assignmentMethod := graphmodels.STANDARD_SENSITIVITYLABELASSIGNMENTMETHOD
requestBody.SetAssignmentMethod(&assignmentMethod)
sensitivityLabelId := "7a4d7cc1-f72b-46a3-9831-02680eaf56f9"
requestBody.SetSensitivityLabelId(&sensitivityLabelId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignSensitivityLabel, err := graphClient.Planner().Rosters().ByPlannerRosterId("plannerRoster-id").AssignSensitivityLabel().Post(context.Background(), requestBody, configuration)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.planner.rosters.item.assignsensitivitylabel.AssignSensitivityLabelPostRequestBody assignSensitivityLabelPostRequestBody = new com.microsoft.graph.beta.planner.rosters.item.assignsensitivitylabel.AssignSensitivityLabelPostRequestBody();
assignSensitivityLabelPostRequestBody.setAssignmentMethod(SensitivityLabelAssignmentMethod.Standard);
assignSensitivityLabelPostRequestBody.setSensitivityLabelId("7a4d7cc1-f72b-46a3-9831-02680eaf56f9");
var result = graphClient.planner().rosters().byPlannerRosterId("{plannerRoster-id}").assignSensitivityLabel().post(assignSensitivityLabelPostRequestBody, requestConfiguration -> {
requestConfiguration.headers.add("If-Match", "\"W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"\"");
});
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Planner\Rosters\Item\AssignSensitivityLabel\AssignSensitivityLabelRequestBuilderPostRequestConfiguration;
use Microsoft\Graph\Beta\Generated\Planner\Rosters\Item\AssignSensitivityLabel\AssignSensitivityLabelPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\SensitivityLabelAssignmentMethod;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AssignSensitivityLabelPostRequestBody();
$requestBody->setAssignmentMethod(new SensitivityLabelAssignmentMethod('standard'));
$requestBody->setSensitivityLabelId('7a4d7cc1-f72b-46a3-9831-02680eaf56f9');
$requestConfiguration = new AssignSensitivityLabelRequestBuilderPostRequestConfiguration();
$headers = [
'If-Match' => '"W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\""',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->planner()->rosters()->byPlannerRosterId('plannerRoster-id')->assignSensitivityLabel()->post($requestBody, $requestConfiguration)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.planner.rosters.item.assign_sensitivity_label.assign_sensitivity_label_request_builder import AssignSensitivityLabelRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.planner.rosters.item.assign_sensitivity_label.assign_sensitivity_label_post_request_body import AssignSensitivityLabelPostRequestBody
from msgraph_beta.generated.models.sensitivity_label_assignment_method import SensitivityLabelAssignmentMethod
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AssignSensitivityLabelPostRequestBody(
assignment_method = SensitivityLabelAssignmentMethod.Standard,
sensitivity_label_id = "7a4d7cc1-f72b-46a3-9831-02680eaf56f9",
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("If-Match", "\"W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"\"")
result = await graph_client.planner.rosters.by_planner_roster_id('plannerRoster-id').assign_sensitivity_label.post(request_body, request_configuration = request_configuration)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.