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.
In the request body, provide a JSON object with the following parameters.
The following example shows how to call this API.
The following example shows a request.
POST https://graph.microsoft.com/beta/informationProtection/policy/labels/evaluateApplication
Content-type: application/json
User-agent: ContosoLOBApp/1.0
{
"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": []
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.InformationProtection.Policy.Labels.EvaluateApplication;
using Microsoft.Graph.Beta.Models;
var requestBody = new EvaluateApplicationPostRequestBody
{
ContentInfo = new ContentInfo
{
OdataType = "#microsoft.graph.contentInfo",
Format = ContentFormat.Default,
Identifier = null,
State = ContentState.Rest,
Metadata = new List<KeyValuePair>
{
new KeyValuePair
{
OdataType = "#microsoft.graph.keyValuePair",
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled",
Value = "True",
},
new KeyValuePair
{
OdataType = "#microsoft.graph.keyValuePair",
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method",
Value = "Standard",
},
new KeyValuePair
{
OdataType = "#microsoft.graph.keyValuePair",
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate",
Value = "1/1/0001 12:00:00 AM",
},
new KeyValuePair
{
OdataType = "#microsoft.graph.keyValuePair",
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId",
Value = "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c",
},
new KeyValuePair
{
OdataType = "#microsoft.graph.keyValuePair",
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name",
Value = "General",
},
new KeyValuePair
{
OdataType = "#microsoft.graph.keyValuePair",
Name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits",
Value = "0",
},
new KeyValuePair
{
OdataType = "#microsoft.graph.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)"
},
},
},
LabelingOptions = new LabelingOptions
{
OdataType = "#microsoft.graph.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)"
},
},
},
};
// 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.EvaluateApplication.PostAsEvaluateApplicationPostResponseAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("User-Agent", "ContosoLOBApp/1.0");
});
mgc-beta information-protection policy labels evaluate-application post --body '{\
"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": []\
}\
}\
'
// 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.PolicyLabelsEvaluateApplicationRequestBuilderPostRequestConfiguration{
Headers: headers,
}
requestBody := graphinformationprotection.NewEvaluateApplicationPostRequestBody()
contentInfo := graphmodels.NewContentInfo()
format := graphmodels.DEFAULT_CONTENTFORMAT
contentInfo.SetFormat(&format)
identifier := null
contentInfo.SetIdentifier(&identifier)
state := graphmodels.REST_CONTENTSTATE
contentInfo.SetState(&state)
keyValuePair := graphmodels.NewKeyValuePair()
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled"
keyValuePair.SetName(&name)
value := "True"
keyValuePair.SetValue(&value)
keyValuePair1 := graphmodels.NewKeyValuePair()
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method"
keyValuePair1.SetName(&name)
value := "Standard"
keyValuePair1.SetValue(&value)
keyValuePair2 := graphmodels.NewKeyValuePair()
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate"
keyValuePair2.SetName(&name)
value := "1/1/0001 12:00:00 AM"
keyValuePair2.SetValue(&value)
keyValuePair3 := graphmodels.NewKeyValuePair()
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId"
keyValuePair3.SetName(&name)
value := "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c"
keyValuePair3.SetValue(&value)
keyValuePair4 := graphmodels.NewKeyValuePair()
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name"
keyValuePair4.SetName(&name)
value := "General"
keyValuePair4.SetValue(&value)
keyValuePair5 := graphmodels.NewKeyValuePair()
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits"
keyValuePair5.SetName(&name)
value := "0"
keyValuePair5.SetValue(&value)
keyValuePair6 := graphmodels.NewKeyValuePair()
name := "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId"
keyValuePair6.SetName(&name)
value := "00000000-0000-0000-0000-000000000000"
keyValuePair6.SetValue(&value)
metadata := []graphmodels.KeyValuePairable {
keyValuePair,
keyValuePair1,
keyValuePair2,
keyValuePair3,
keyValuePair4,
keyValuePair5,
keyValuePair6,
}
contentInfo.SetMetadata(metadata)
additionalData := map[string]interface{}{
"format@odata.type" : "#microsoft.graph.contentFormat",
"state@odata.type" : "#microsoft.graph.contentState",
"metadata@odata.type" : "#Collection(microsoft.graph.keyValuePair)",
}
contentInfo.SetAdditionalData(additionalData)
requestBody.SetContentInfo(contentInfo)
labelingOptions := graphmodels.NewLabelingOptions()
assignmentMethod := graphmodels.STANDARD_ASSIGNMENTMETHOD
labelingOptions.SetAssignmentMethod(&assignmentMethod)
labelId := "97309856-9c28-4ac6-9382-5f8bc20c457b"
labelingOptions.SetLabelId(&labelId)
downgradeJustification := null
labelingOptions.SetDowngradeJustification(&downgradeJustification)
extendedProperties := []graphmodels.KeyValuePairable {
}
labelingOptions.SetExtendedProperties(extendedProperties)
additionalData := map[string]interface{}{
"assignmentMethod@odata.type" : "#microsoft.graph.assignmentMethod",
"labelId@odata.type" : "#Guid",
"extendedProperties@odata.type" : "#Collection(microsoft.graph.keyValuePair)",
}
labelingOptions.SetAdditionalData(additionalData)
requestBody.SetLabelingOptions(labelingOptions)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
evaluateApplication, err := graphClient.InformationProtection().Policy().Labels().EvaluateApplication().PostAsEvaluateApplicationPostResponse(context.Background(), requestBody, configuration)
// 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.evaluateapplication.EvaluateApplicationPostRequestBody evaluateApplicationPostRequestBody = new com.microsoft.graph.beta.informationprotection.policy.labels.evaluateapplication.EvaluateApplicationPostRequestBody();
ContentInfo contentInfo = new ContentInfo();
contentInfo.setOdataType("#microsoft.graph.contentInfo");
contentInfo.setFormat(ContentFormat.Default);
contentInfo.setIdentifier(null);
contentInfo.setState(ContentState.Rest);
LinkedList<KeyValuePair> metadata = new LinkedList<KeyValuePair>();
KeyValuePair keyValuePair = new KeyValuePair();
keyValuePair.setOdataType("#microsoft.graph.keyValuePair");
keyValuePair.setName("MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled");
keyValuePair.setValue("True");
metadata.add(keyValuePair);
KeyValuePair keyValuePair1 = new KeyValuePair();
keyValuePair1.setOdataType("#microsoft.graph.keyValuePair");
keyValuePair1.setName("MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method");
keyValuePair1.setValue("Standard");
metadata.add(keyValuePair1);
KeyValuePair keyValuePair2 = new KeyValuePair();
keyValuePair2.setOdataType("#microsoft.graph.keyValuePair");
keyValuePair2.setName("MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate");
keyValuePair2.setValue("1/1/0001 12:00:00 AM");
metadata.add(keyValuePair2);
KeyValuePair keyValuePair3 = new KeyValuePair();
keyValuePair3.setOdataType("#microsoft.graph.keyValuePair");
keyValuePair3.setName("MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId");
keyValuePair3.setValue("cfa4cf1d-a337-4481-aa99-19d8f3d63f7c");
metadata.add(keyValuePair3);
KeyValuePair keyValuePair4 = new KeyValuePair();
keyValuePair4.setOdataType("#microsoft.graph.keyValuePair");
keyValuePair4.setName("MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name");
keyValuePair4.setValue("General");
metadata.add(keyValuePair4);
KeyValuePair keyValuePair5 = new KeyValuePair();
keyValuePair5.setOdataType("#microsoft.graph.keyValuePair");
keyValuePair5.setName("MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits");
keyValuePair5.setValue("0");
metadata.add(keyValuePair5);
KeyValuePair keyValuePair6 = new KeyValuePair();
keyValuePair6.setOdataType("#microsoft.graph.keyValuePair");
keyValuePair6.setName("MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId");
keyValuePair6.setValue("00000000-0000-0000-0000-000000000000");
metadata.add(keyValuePair6);
contentInfo.setMetadata(metadata);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("format@odata.type", "#microsoft.graph.contentFormat");
additionalData.put("state@odata.type", "#microsoft.graph.contentState");
additionalData.put("metadata@odata.type", "#Collection(microsoft.graph.keyValuePair)");
contentInfo.setAdditionalData(additionalData);
evaluateApplicationPostRequestBody.setContentInfo(contentInfo);
LabelingOptions labelingOptions = new LabelingOptions();
labelingOptions.setOdataType("#microsoft.graph.labelingOptions");
labelingOptions.setAssignmentMethod(AssignmentMethod.Standard);
labelingOptions.setLabelId("97309856-9c28-4ac6-9382-5f8bc20c457b");
labelingOptions.setDowngradeJustification(null);
LinkedList<KeyValuePair> extendedProperties = new LinkedList<KeyValuePair>();
labelingOptions.setExtendedProperties(extendedProperties);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("assignmentMethod@odata.type", "#microsoft.graph.assignmentMethod");
additionalData1.put("labelId@odata.type", "#Guid");
additionalData1.put("extendedProperties@odata.type", "#Collection(microsoft.graph.keyValuePair)");
labelingOptions.setAdditionalData(additionalData1);
evaluateApplicationPostRequestBody.setLabelingOptions(labelingOptions);
var result = graphClient.informationProtection().policy().labels().evaluateApplication().post(evaluateApplicationPostRequestBody, requestConfiguration -> {
requestConfiguration.headers.add("User-Agent", "ContosoLOBApp/1.0");
});
const options = {
authProvider,
};
const client = Client.init(options);
const informationProtectionAction = {
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: []
}
};
await client.api('/informationProtection/policy/labels/evaluateApplication')
.version('beta')
.post(informationProtectionAction);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\InformationProtection\Policy\Labels\EvaluateApplication\EvaluateApplicationRequestBuilderPostRequestConfiguration;
use Microsoft\Graph\Beta\Generated\InformationProtection\Policy\Labels\EvaluateApplication\EvaluateApplicationPostRequestBody;
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\KeyValuePair;
use Microsoft\Graph\Beta\Generated\Models\LabelingOptions;
use Microsoft\Graph\Beta\Generated\Models\AssignmentMethod;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EvaluateApplicationPostRequestBody();
$contentInfo = new ContentInfo();
$contentInfo->setOdataType('#microsoft.graph.contentInfo');
$contentInfo->setFormat(new ContentFormat('default'));
$contentInfo->setIdentifier(null);
$contentInfo->setState(new ContentState('rest'));
$metadataKeyValuePair1 = new KeyValuePair();
$metadataKeyValuePair1->setOdataType('#microsoft.graph.keyValuePair');
$metadataKeyValuePair1->setName('MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled');
$metadataKeyValuePair1->setValue('True');
$metadataArray []= $metadataKeyValuePair1;
$metadataKeyValuePair2 = new KeyValuePair();
$metadataKeyValuePair2->setOdataType('#microsoft.graph.keyValuePair');
$metadataKeyValuePair2->setName('MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method');
$metadataKeyValuePair2->setValue('Standard');
$metadataArray []= $metadataKeyValuePair2;
$metadataKeyValuePair3 = new KeyValuePair();
$metadataKeyValuePair3->setOdataType('#microsoft.graph.keyValuePair');
$metadataKeyValuePair3->setName('MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate');
$metadataKeyValuePair3->setValue('1/1/0001 12:00:00 AM');
$metadataArray []= $metadataKeyValuePair3;
$metadataKeyValuePair4 = new KeyValuePair();
$metadataKeyValuePair4->setOdataType('#microsoft.graph.keyValuePair');
$metadataKeyValuePair4->setName('MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId');
$metadataKeyValuePair4->setValue('cfa4cf1d-a337-4481-aa99-19d8f3d63f7c');
$metadataArray []= $metadataKeyValuePair4;
$metadataKeyValuePair5 = new KeyValuePair();
$metadataKeyValuePair5->setOdataType('#microsoft.graph.keyValuePair');
$metadataKeyValuePair5->setName('MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name');
$metadataKeyValuePair5->setValue('General');
$metadataArray []= $metadataKeyValuePair5;
$metadataKeyValuePair6 = new KeyValuePair();
$metadataKeyValuePair6->setOdataType('#microsoft.graph.keyValuePair');
$metadataKeyValuePair6->setName('MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits');
$metadataKeyValuePair6->setValue('0');
$metadataArray []= $metadataKeyValuePair6;
$metadataKeyValuePair7 = new KeyValuePair();
$metadataKeyValuePair7->setOdataType('#microsoft.graph.keyValuePair');
$metadataKeyValuePair7->setName('MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId');
$metadataKeyValuePair7->setValue('00000000-0000-0000-0000-000000000000');
$metadataArray []= $metadataKeyValuePair7;
$contentInfo->setMetadata($metadataArray);
$additionalData = [
'format@odata.type' => '#microsoft.graph.contentFormat',
'state@odata.type' => '#microsoft.graph.contentState',
'metadata@odata.type' => '#Collection(microsoft.graph.keyValuePair)',
];
$contentInfo->setAdditionalData($additionalData);
$requestBody->setContentInfo($contentInfo);
$labelingOptions = new LabelingOptions();
$labelingOptions->setOdataType('#microsoft.graph.labelingOptions');
$labelingOptions->setAssignmentMethod(new AssignmentMethod('standard'));
$labelingOptions->setLabelId('97309856-9c28-4ac6-9382-5f8bc20c457b');
$labelingOptions->setDowngradeJustification(null);
$labelingOptions->setExtendedProperties([]);
$additionalData = [
'assignmentMethod@odata.type' => '#microsoft.graph.assignmentMethod',
'labelId@odata.type' => '#Guid',
'extendedProperties@odata.type' => '#Collection(microsoft.graph.keyValuePair)',
];
$labelingOptions->setAdditionalData($additionalData);
$requestBody->setLabelingOptions($labelingOptions);
$requestConfiguration = new EvaluateApplicationRequestBuilderPostRequestConfiguration();
$headers = [
'User-Agent' => 'ContosoLOBApp/1.0',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->informationProtection()->policy()->labels()->evaluateApplication()->post($requestBody, $requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.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-MgBetaInformationProtectionPolicyLabelApplication -BodyParameter $params
# 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_application.evaluate_application_request_builder import EvaluateApplicationRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.informationprotection.policy.labels.evaluate_application.evaluate_application_post_request_body import EvaluateApplicationPostRequestBody
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.key_value_pair import KeyValuePair
from msgraph_beta.generated.models.labeling_options import LabelingOptions
from msgraph_beta.generated.models.assignment_method import AssignmentMethod
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EvaluateApplicationPostRequestBody(
content_info = ContentInfo(
odata_type = "#microsoft.graph.contentInfo",
format = ContentFormat.Default,
identifier = None,
state = ContentState.Rest,
metadata = [
KeyValuePair(
odata_type = "#microsoft.graph.keyValuePair",
name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Enabled",
value = "True",
),
KeyValuePair(
odata_type = "#microsoft.graph.keyValuePair",
name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Method",
value = "Standard",
),
KeyValuePair(
odata_type = "#microsoft.graph.keyValuePair",
name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SetDate",
value = "1/1/0001 12:00:00 AM",
),
KeyValuePair(
odata_type = "#microsoft.graph.keyValuePair",
name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_SiteId",
value = "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c",
),
KeyValuePair(
odata_type = "#microsoft.graph.keyValuePair",
name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_Name",
value = "General",
),
KeyValuePair(
odata_type = "#microsoft.graph.keyValuePair",
name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ContentBits",
value = "0",
),
KeyValuePair(
odata_type = "#microsoft.graph.keyValuePair",
name = "MSIP_Label_722a5300-ac39-4c9a-88e3-f54c46676417_ActionId",
value = "00000000-0000-0000-0000-000000000000",
),
],
additional_data = {
"format@odata_type" : "#microsoft.graph.contentFormat",
"state@odata_type" : "#microsoft.graph.contentState",
"metadata@odata_type" : "#Collection(microsoft.graph.keyValuePair)",
}
),
labeling_options = LabelingOptions(
odata_type = "#microsoft.graph.labelingOptions",
assignment_method = AssignmentMethod.Standard,
label_id = "97309856-9c28-4ac6-9382-5f8bc20c457b",
downgrade_justification = None,
extended_properties = [
],
additional_data = {
"assignment_method@odata_type" : "#microsoft.graph.assignmentMethod",
"label_id@odata_type" : "#Guid",
"extended_properties@odata_type" : "#Collection(microsoft.graph.keyValuePair)",
}
),
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("User-Agent", "ContosoLOBApp/1.0")
result = await graph_client.information_protection.policy.labels.evaluate_application.post(request_body, request_configuration = request_configuration)
The following example shows the response.