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.
Caution
The Information Protection labels API is deprecated and will stop returning data on January 1, 2023. Please use the new informationProtection, sensitivityLabel, and associated resources.
Using classification results, compute the information protection label that should be applied and return the set of actions that must be taken to correctly label the information. This API is useful when a label should be set automatically based on classification of the file contents, rather than labeled directly by a user or service.
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)
InformationProtectionPolicy.Read
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
InformationProtectionPolicy.Read.All
Not available.
HTTP request
POST /informationProtection/policy/labels/evaluateClassificationResults
Describes the name and version of the calling application. Details will surface in Azure Information Protection Analytics. Suggested format is ApplicationName/Version. Optional.
Request body
In the request body, provide a JSON object with the following parameters.
Contains the set of classification results returned by the data classification endpoint. Classification information is used to determine the appropriate label based on the Microsoft Purview Information Protection policy label configuration in Microsoft 365 Security and Compliance Center.
Response
If successful, this method returns a 200 OK response code and a new informationProtectionAction collection object in the response body.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.InformationProtection.Policy.Labels.EvaluateClassificationResults;
using Microsoft.Graph.Beta.Models;
var requestBody = new EvaluateClassificationResultsPostRequestBody
{
ContentInfo = new ContentInfo
{
OdataType = "#microsoft.graph.contentInfo",
Format = ContentFormat.Default,
Identifier = null,
State = ContentState.Rest,
AdditionalData = new Dictionary<string, object>
{
{
"format@odata.type" , "#microsoft.graph.contentFormat"
},
{
"state@odata.type" , "#microsoft.graph.contentState"
},
},
},
ClassificationResults = new List<ClassificationResult>
{
new ClassificationResult
{
SensitiveTypeId = "cb353f78-2b72-4c3c-8827-92ebe4f69fdf",
Count = 4,
ConfidenceLevel = 75,
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.InformationProtection.Policy.Labels.EvaluateClassificationResults.PostAsEvaluateClassificationResultsPostResponseAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("User-Agent", "ContosoLOBApp/1.0");
});
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"
graphinformationprotection "github.com/microsoftgraph/msgraph-beta-sdk-go/informationprotection"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("User-Agent", "ContosoLOBApp/1.0")
configuration := &graphinformationprotection.InformationProtectionPolicyLabelsEvaluateClassificationResultsRequestBuilderPostRequestConfiguration{
Headers: headers,
}
requestBody := graphinformationprotection.NewEvaluateClassificationResultsPostRequestBody()
contentInfo := graphmodels.NewContentInfo()
format := graphmodels.DEFAULT_CONTENTFORMAT
contentInfo.SetFormat(&format)
identifier := null
contentInfo.SetIdentifier(&identifier)
state := graphmodels.REST_CONTENTSTATE
contentInfo.SetState(&state)
additionalData := map[string]interface{}{
"format@odata.type" : "#microsoft.graph.contentFormat",
"state@odata.type" : "#microsoft.graph.contentState",
}
contentInfo.SetAdditionalData(additionalData)
requestBody.SetContentInfo(contentInfo)
classificationResult := graphmodels.NewClassificationResult()
sensitiveTypeId := "cb353f78-2b72-4c3c-8827-92ebe4f69fdf"
classificationResult.SetSensitiveTypeId(&sensitiveTypeId)
count := int32(4)
classificationResult.SetCount(&count)
confidenceLevel := int32(75)
classificationResult.SetConfidenceLevel(&confidenceLevel)
classificationResults := []graphmodels.ClassificationResultable {
classificationResult,
}
requestBody.SetClassificationResults(classificationResults)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
evaluateClassificationResults, err := graphClient.InformationProtection().Policy().Labels().EvaluateClassificationResults().PostAsEvaluateClassificationResultsPostResponse(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.informationprotection.policy.labels.evaluateclassificationresults.EvaluateClassificationResultsPostRequestBody evaluateClassificationResultsPostRequestBody = new com.microsoft.graph.beta.informationprotection.policy.labels.evaluateclassificationresults.EvaluateClassificationResultsPostRequestBody();
ContentInfo contentInfo = new ContentInfo();
contentInfo.setOdataType("#microsoft.graph.contentInfo");
contentInfo.setFormat(ContentFormat.Default);
contentInfo.setIdentifier(null);
contentInfo.setState(ContentState.Rest);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("format@odata.type", "#microsoft.graph.contentFormat");
additionalData.put("state@odata.type", "#microsoft.graph.contentState");
contentInfo.setAdditionalData(additionalData);
evaluateClassificationResultsPostRequestBody.setContentInfo(contentInfo);
LinkedList<ClassificationResult> classificationResults = new LinkedList<ClassificationResult>();
ClassificationResult classificationResult = new ClassificationResult();
classificationResult.setSensitiveTypeId("cb353f78-2b72-4c3c-8827-92ebe4f69fdf");
classificationResult.setCount(4);
classificationResult.setConfidenceLevel(75);
classificationResults.add(classificationResult);
evaluateClassificationResultsPostRequestBody.setClassificationResults(classificationResults);
var result = graphClient.informationProtection().policy().labels().evaluateClassificationResults().post(evaluateClassificationResultsPostRequestBody, requestConfiguration -> {
requestConfiguration.headers.add("User-Agent", "ContosoLOBApp/1.0");
});
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\InformationProtection\Policy\Labels\EvaluateClassificationResults\EvaluateClassificationResultsRequestBuilderPostRequestConfiguration;
use Microsoft\Graph\Beta\Generated\InformationProtection\Policy\Labels\EvaluateClassificationResults\EvaluateClassificationResultsPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\ContentInfo;
use Microsoft\Graph\Beta\Generated\Models\ContentFormat;
use Microsoft\Graph\Beta\Generated\Models\ContentState;
use Microsoft\Graph\Beta\Generated\Models\ClassificationResult;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EvaluateClassificationResultsPostRequestBody();
$contentInfo = new ContentInfo();
$contentInfo->setOdataType('#microsoft.graph.contentInfo');
$contentInfo->setFormat(new ContentFormat('default'));
$contentInfo->setIdentifier(null);
$contentInfo->setState(new ContentState('rest'));
$additionalData = [
'format@odata.type' => '#microsoft.graph.contentFormat',
'state@odata.type' => '#microsoft.graph.contentState',
];
$contentInfo->setAdditionalData($additionalData);
$requestBody->setContentInfo($contentInfo);
$classificationResultsClassificationResult1 = new ClassificationResult();
$classificationResultsClassificationResult1->setSensitiveTypeId('cb353f78-2b72-4c3c-8827-92ebe4f69fdf');
$classificationResultsClassificationResult1->setCount(4);
$classificationResultsClassificationResult1->setConfidenceLevel(75);
$classificationResultsArray []= $classificationResultsClassificationResult1;
$requestBody->setClassificationResults($classificationResultsArray);
$requestConfiguration = new EvaluateClassificationResultsRequestBuilderPostRequestConfiguration();
$headers = [
'User-Agent' => 'ContosoLOBApp/1.0',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->informationProtection()->policy()->labels()->evaluateClassificationResults()->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.information_protection.policy.labels.evaluate_classification_results.evaluate_classification_results_request_builder import EvaluateClassificationResultsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.informationprotection.policy.labels.evaluate_classification_results.evaluate_classification_results_post_request_body import EvaluateClassificationResultsPostRequestBody
from msgraph_beta.generated.models.content_info import ContentInfo
from msgraph_beta.generated.models.content_format import ContentFormat
from msgraph_beta.generated.models.content_state import ContentState
from msgraph_beta.generated.models.classification_result import ClassificationResult
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EvaluateClassificationResultsPostRequestBody(
content_info = ContentInfo(
odata_type = "#microsoft.graph.contentInfo",
format = ContentFormat.Default,
identifier = None,
state = ContentState.Rest,
additional_data = {
"format@odata_type" : "#microsoft.graph.contentFormat",
"state@odata_type" : "#microsoft.graph.contentState",
}
),
classification_results = [
ClassificationResult(
sensitive_type_id = "cb353f78-2b72-4c3c-8827-92ebe4f69fdf",
count = 4,
confidence_level = 75,
),
],
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("User-Agent", "ContosoLOBApp/1.0")
result = await graph_client.information_protection.policy.labels.evaluate_classification_results.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.