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.
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 manually or explicitly by a user or service, rather than automatically based on file contents.
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
InformationProtectionPolicy.Read
Delegated (personal Microsoft account)
Not supported.
Application
InformationProtectionPolicy.Read.All
HTTP request
POST me/informationProtection/policy/labels/evaluateApplication
POST /users/{id}/informationProtection/policy/labels/evaluateApplication
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-type
application/json. Required.
User-Agent
Describes the name 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.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var contentInfo = new ContentInfo
{
Format = ContentFormat.Default,
Identifier = null,
State = ContentState.Rest,
Metadata = new List<KeyValuePair>()
{
new KeyValuePair
{
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled",
Value = "True"
},
new KeyValuePair
{
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method",
Value = "Standard"
},
new KeyValuePair
{
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate",
Value = "1/1/0001 12:00:00 AM"
},
new KeyValuePair
{
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId",
Value = "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c"
},
new KeyValuePair
{
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name",
Value = "General"
},
new KeyValuePair
{
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits",
Value = "0"
},
new KeyValuePair
{
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId",
Value = "00000000-0000-0000-0000-000000000000"
}
},
AdditionalData = new Dictionary<string, object>()
{
{"format@odata.type", "#microsoft.graph.contentFormat"},
{"state@odata.type", "#microsoft.graph.contentState"},
{"metadata@odata.type", "#Collection(microsoft.graph.keyValuePair)"}
}
};
var labelingOptions = new LabelingOptions
{
AssignmentMethod = AssignmentMethod.Standard,
LabelId = "97309856-9c28-4ac6-9382-5f8bc20c457b",
DowngradeJustification = null,
ExtendedProperties = new List<KeyValuePair>()
{
},
AdditionalData = new Dictionary<string, object>()
{
{"assignmentMethod@odata.type", "#microsoft.graph.assignmentMethod"},
{"labelId@odata.type", "#Guid"},
{"extendedProperties@odata.type", "#Collection(microsoft.graph.keyValuePair)"}
}
};
await graphClient.InformationProtection.Policy.Labels
.EvaluateApplication(contentInfo,labelingOptions)
.Request()
.Header("User-Agent","ContosoLOBApp/1.0")
.PostAsync();
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.
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.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new HeaderOption("User-Agent", "ContosoLOBApp/1.0"));
ContentInfo contentInfo = new ContentInfo();
contentInfo.additionalDataManager().put("format@odata.type", new JsonPrimitive("#microsoft.graph.contentFormat"));
contentInfo.format = ContentFormat.DEFAULT;
contentInfo.identifier = null;
contentInfo.additionalDataManager().put("state@odata.type", new JsonPrimitive("#microsoft.graph.contentState"));
contentInfo.state = ContentState.REST;
contentInfo.additionalDataManager().put("metadata@odata.type", new JsonPrimitive("#Collection(microsoft.graph.keyValuePair)"));
LinkedList<KeyValuePair> metadataList = new LinkedList<KeyValuePair>();
KeyValuePair metadata = new KeyValuePair();
metadata.name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled";
metadata.value = "True";
metadataList.add(metadata);
KeyValuePair metadata1 = new KeyValuePair();
metadata1.name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method";
metadata1.value = "Standard";
metadataList.add(metadata1);
KeyValuePair metadata2 = new KeyValuePair();
metadata2.name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate";
metadata2.value = "1/1/0001 12:00:00 AM";
metadataList.add(metadata2);
KeyValuePair metadata3 = new KeyValuePair();
metadata3.name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId";
metadata3.value = "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c";
metadataList.add(metadata3);
KeyValuePair metadata4 = new KeyValuePair();
metadata4.name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name";
metadata4.value = "General";
metadataList.add(metadata4);
KeyValuePair metadata5 = new KeyValuePair();
metadata5.name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits";
metadata5.value = "0";
metadataList.add(metadata5);
KeyValuePair metadata6 = new KeyValuePair();
metadata6.name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId";
metadata6.value = "00000000-0000-0000-0000-000000000000";
metadataList.add(metadata6);
contentInfo.metadata = metadataList;
LabelingOptions labelingOptions = new LabelingOptions();
labelingOptions.additionalDataManager().put("assignmentMethod@odata.type", new JsonPrimitive("#microsoft.graph.assignmentMethod"));
labelingOptions.assignmentMethod = AssignmentMethod.STANDARD;
labelingOptions.additionalDataManager().put("labelId@odata.type", new JsonPrimitive("#Guid"));
labelingOptions.labelId = "97309856-9c28-4ac6-9382-5f8bc20c457b";
labelingOptions.downgradeJustification = null;
labelingOptions.additionalDataManager().put("extendedProperties@odata.type", new JsonPrimitive("#Collection(microsoft.graph.keyValuePair)"));
LinkedList<KeyValuePair> extendedPropertiesList = new LinkedList<KeyValuePair>();
labelingOptions.extendedProperties = extendedPropertiesList;
graphClient.informationProtection().policy().labels()
.evaluateApplication(InformationProtectionLabelEvaluateApplicationParameterSet
.newBuilder()
.withContentInfo(contentInfo)
.withLabelingOptions(labelingOptions)
.build())
.buildRequest( requestOptions )
.post();
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.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
contentInfo := msgraphsdk.NewContentInfo()
requestBody.SetContentInfo(contentInfo)
format := "default"
contentInfo.SetFormat(&format)
contentInfo.SetIdentifier(nil)
state := "rest"
contentInfo.SetState(&state)
contentInfo.SetMetadata( []KeyValuePair {
msgraphsdk.NewKeyValuePair(),
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled"
SetName(&name)
value := "True"
SetValue(&value)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.keyValuePair",
}
msgraphsdk.NewKeyValuePair(),
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method"
SetName(&name)
value := "Standard"
SetValue(&value)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.keyValuePair",
}
msgraphsdk.NewKeyValuePair(),
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate"
SetName(&name)
value := "1/1/0001 12:00:00 AM"
SetValue(&value)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.keyValuePair",
}
msgraphsdk.NewKeyValuePair(),
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId"
SetName(&name)
value := "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c"
SetValue(&value)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.keyValuePair",
}
msgraphsdk.NewKeyValuePair(),
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name"
SetName(&name)
value := "General"
SetValue(&value)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.keyValuePair",
}
msgraphsdk.NewKeyValuePair(),
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits"
SetName(&name)
value := "0"
SetValue(&value)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.keyValuePair",
}
msgraphsdk.NewKeyValuePair(),
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId"
SetName(&name)
value := "00000000-0000-0000-0000-000000000000"
SetValue(&value)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.keyValuePair",
}
}
contentInfo.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.contentInfo",
"format@odata.type": "#microsoft.graph.contentFormat",
"state@odata.type": "#microsoft.graph.contentState",
"metadata@odata.type": "#Collection(microsoft.graph.keyValuePair)",
}
labelingOptions := msgraphsdk.NewLabelingOptions()
requestBody.SetLabelingOptions(labelingOptions)
assignmentMethod := "standard"
labelingOptions.SetAssignmentMethod(&assignmentMethod)
labelId := "97309856-9c28-4ac6-9382-5f8bc20c457b"
labelingOptions.SetLabelId(&labelId)
labelingOptions.SetDowngradeJustification(nil)
labelingOptions.SetExtendedProperties( []KeyValuePair {
}
labelingOptions.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.labelingOptions",
"assignmentMethod@odata.type": "#microsoft.graph.assignmentMethod",
"labelId@odata.type": "#Guid",
"extendedProperties@odata.type": "#Collection(microsoft.graph.keyValuePair)",
}
headers := map[string]string{
"User-Agent": "ContosoLOBApp/1.0"
}
options := &msgraphsdk.EvaluateApplicationRequestBuilderPostRequestConfiguration{
Headers: headers,
}
result, err := graphClient.InformationProtection().Policy().Labels().EvaluateApplication().PostWithRequestConfigurationAndResponseHandler(requestBody, options, nil)
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.
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
ContentInfo = @{
"@odata.type" = "#microsoft.graph.contentInfo"
"Format@odata.type" = "#microsoft.graph.contentFormat"
Format = "default"
Identifier = $null
"State@odata.type" = "#microsoft.graph.contentState"
State = "rest"
"Metadata@odata.type" = "#Collection(microsoft.graph.keyValuePair)"
Metadata = @(
@{
"@odata.type" = "#microsoft.graph.keyValuePair"
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled"
Value = "True"
}
@{
"@odata.type" = "#microsoft.graph.keyValuePair"
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method"
Value = "Standard"
}
@{
"@odata.type" = "#microsoft.graph.keyValuePair"
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate"
Value = "1/1/0001 12:00:00 AM"
}
@{
"@odata.type" = "#microsoft.graph.keyValuePair"
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId"
Value = "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c"
}
@{
"@odata.type" = "#microsoft.graph.keyValuePair"
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name"
Value = "General"
}
@{
"@odata.type" = "#microsoft.graph.keyValuePair"
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits"
Value = "0"
}
@{
"@odata.type" = "#microsoft.graph.keyValuePair"
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId"
Value = "00000000-0000-0000-0000-000000000000"
}
)
}
LabelingOptions = @{
"@odata.type" = "#microsoft.graph.labelingOptions"
"AssignmentMethod@odata.type" = "#microsoft.graph.assignmentMethod"
AssignmentMethod = "standard"
"LabelId@odata.type" = "#Guid"
LabelId = "97309856-9c28-4ac6-9382-5f8bc20c457b"
DowngradeJustification = $null
"ExtendedProperties@odata.type" = "#Collection(microsoft.graph.keyValuePair)"
ExtendedProperties = @(
)
}
}
Test-MgInformationProtectionPolicyLabelApplication -BodyParameter $params
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.