As APIs na versão /beta no Microsoft Graph estão sujeitas a alterações. Não há suporte para o uso dessas APIs em aplicativos de produção. Para determinar se uma API está disponível na v1.0, use o seletor de versão.
Calcule o rótulo de proteção de informações que deve ser aplicado e retorne o conjunto de ações que devem ser tomadas para rotular corretamente as informações. Essa API é útil quando um rótulo deve ser definido manualmente ou explicitamente por um usuário ou serviço, em vez de se basear automaticamente no conteúdo do arquivo.
Uma das seguintes permissões é obrigatória para chamar esta API. Para saber mais, incluindo como escolher permissões, confira Permissões.
Tipo de permissão
Permissões (da com menos para a com mais privilégios)
Delegado (conta corporativa ou de estudante)
InformationProtectionPolicy. Read
Delegado (conta pessoal da Microsoft)
Sem suporte.
Aplicativo
InformationProtectionPolicy.Read.All
Solicitação HTTP
POST me/informationProtection/policy/labels/evaluateApplication
POST /users/{id}/informationProtection/policy/labels/evaluateApplication
Cabeçalhos de solicitação
Nome
Descrição
Autorização
{token} de portador. Obrigatório.
Content-type
application/json. Obrigatório.
User-Agent
Descreve o nome do aplicativo de chamada. Os detalhes aparecerão no Azure Information Protection Analytics. O formato sugerido é ApplicationName/Version. Opcional.
Corpo da solicitação
Forneça um objeto JSON com os seguintes parâmetros no corpo da solicitação.
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();
Importante
Os SDKs do Microsoft Graph usam a versão v1.0 da API por padrão e não dão suporte a todos os tipos, propriedades e APIs disponíveis na versão beta. Para obter detalhes sobre como acessar a API beta com o SDK, consulte Usar os SDKs do Microsoft Graph com a API beta.
Os SDKs do Microsoft Graph usam a versão v1.0 da API por padrão e não dão suporte a todos os tipos, propriedades e APIs disponíveis na versão beta. Para obter detalhes sobre como acessar a API beta com o SDK, consulte Usar os SDKs do Microsoft Graph com a API beta.
Os SDKs do Microsoft Graph usam a versão v1.0 da API por padrão e não dão suporte a todos os tipos, propriedades e APIs disponíveis na versão beta. Para obter detalhes sobre como acessar a API beta com o SDK, consulte Usar os SDKs do Microsoft Graph com a API beta.
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();
Importante
Os SDKs do Microsoft Graph usam a versão v1.0 da API por padrão e não dão suporte a todos os tipos, propriedades e APIs disponíveis na versão beta. Para obter detalhes sobre como acessar a API beta com o SDK, consulte Usar os SDKs do Microsoft Graph com a API beta.
//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)
Importante
Os SDKs do Microsoft Graph usam a versão v1.0 da API por padrão e não dão suporte a todos os tipos, propriedades e APIs disponíveis na versão beta. Para obter detalhes sobre como acessar a API beta com o SDK, consulte Usar os SDKs do Microsoft Graph com a API beta.
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
Importante
Os SDKs do Microsoft Graph usam a versão v1.0 da API por padrão e não dão suporte a todos os tipos, propriedades e APIs disponíveis na versão beta. Para obter detalhes sobre como acessar a API beta com o SDK, consulte Usar os SDKs do Microsoft Graph com a API beta.