Namespace: microsoft.graph
Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classified
as specified in the override.
Note
- If an override already exists with the same SMTP address, then the classifyAs and name fields of that override are updated with the provided values.
- The maximum number of overrides supported for a mailbox is 1000, based on unique sender SMTP addresses.
- The POST operation supports creating only one override at a time.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
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) |
Mail.ReadWrite |
Not available. |
Delegated (personal Microsoft account) |
Mail.ReadWrite |
Not available. |
Application |
Mail.ReadWrite |
Not available. |
HTTP request
POST /me/inferenceClassification/overrides
POST /users/{id}/inferenceClassification/overrides
Name |
Type |
Description |
Authorization |
string |
Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type |
string |
Nature of the data in the body of an entity. Required. |
Request body
In the request body, supply a JSON representation of inferenceClassificationOverride object.
Response
If successful, this method returns 201 Created
response code and an inferenceClassificationOverride object in the response body.
Example
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/me/inferenceClassification/overrides
Content-type: application/json
{
"classifyAs": "focused",
"senderEmailAddress": {
"name": "Samantha Booth",
"address": "[email protected]"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new InferenceClassificationOverride
{
ClassifyAs = InferenceClassificationType.Focused,
SenderEmailAddress = new EmailAddress
{
Name = "Samantha Booth",
Address = "[email protected]",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.InferenceClassification.Overrides.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewInferenceClassificationOverride()
classifyAs := graphmodels.FOCUSED_INFERENCECLASSIFICATIONTYPE
requestBody.SetClassifyAs(&classifyAs)
senderEmailAddress := graphmodels.NewEmailAddress()
name := "Samantha Booth"
senderEmailAddress.SetName(&name)
address := "[email protected]"
senderEmailAddress.SetAddress(&address)
requestBody.SetSenderEmailAddress(senderEmailAddress)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
overrides, err := graphClient.Me().InferenceClassification().Overrides().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
InferenceClassificationOverride inferenceClassificationOverride = new InferenceClassificationOverride();
inferenceClassificationOverride.setClassifyAs(InferenceClassificationType.Focused);
EmailAddress senderEmailAddress = new EmailAddress();
senderEmailAddress.setName("Samantha Booth");
senderEmailAddress.setAddress("[email protected]");
inferenceClassificationOverride.setSenderEmailAddress(senderEmailAddress);
InferenceClassificationOverride result = graphClient.me().inferenceClassification().overrides().post(inferenceClassificationOverride);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const inferenceClassificationOverride = {
classifyAs: 'focused',
senderEmailAddress: {
name: 'Samantha Booth',
address: '[email protected]'
}
};
await client.api('/me/inferenceClassification/overrides')
.post(inferenceClassificationOverride);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\InferenceClassificationOverride;
use Microsoft\Graph\Generated\Models\InferenceClassificationType;
use Microsoft\Graph\Generated\Models\EmailAddress;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new InferenceClassificationOverride();
$requestBody->setClassifyAs(new InferenceClassificationType('focused'));
$senderEmailAddress = new EmailAddress();
$senderEmailAddress->setName('Samantha Booth');
$senderEmailAddress->setAddress('[email protected]');
$requestBody->setSenderEmailAddress($senderEmailAddress);
$result = $graphServiceClient->me()->inferenceClassification()->overrides()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Mail
$params = @{
classifyAs = "focused"
senderEmailAddress = @{
name = "Samantha Booth"
address = "[email protected]"
}
}
# A UPN can also be used as -UserId.
New-MgUserInferenceClassificationOverride -UserId $userId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.inference_classification_override import InferenceClassificationOverride
from msgraph.generated.models.inference_classification_type import InferenceClassificationType
from msgraph.generated.models.email_address import EmailAddress
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = InferenceClassificationOverride(
classify_as = InferenceClassificationType.Focused,
sender_email_address = EmailAddress(
name = "Samantha Booth",
address = "[email protected]",
),
)
result = await graph_client.me.inference_classification.overrides.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response. Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"classifyAs": "focused",
"senderEmailAddress": {
"name": "Samantha Booth",
"address": "[email protected]"
},
"id": "98f5bdef-576a-404d-a2ea-07a3cf11a9b9"
}