Namespace: microsoft.graph.security
Important
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.
Remove a potential threat from end users' mailboxes.
Remediation means to take prescribed action against a threat. This API can trigger email purge actions like move to junk, move to deleted items, soft delete, hard delete, or move to Inbox. This API enables scenarios and use cases such as SOAR integration, playbooks, and automations. For more information read email remediation, trigger action and track actions. If there is false positives admins can take move to inbox action.
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) |
Not supported. |
Not supported. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
SecurityAnalyzedMessage.ReadWrite.All |
Not available. |
HTTP request
POST /security/collaboration/analyzedEmails/remediate
Request body
In the request body, supply a JSON representation of the parameters.
The following table lists the parameters that are required when you call this action.
Parameter |
Type |
Description |
displayName |
String |
The name of the remediation that is used as a reference in the action center. |
description |
String |
The description of the remediation. |
severity |
microsoft.graph.security.remediationSeverity |
The severity of the remediation. The possible values are: low , medium , high , unknownFutureValue . |
action |
microsoft.graph.security.remediationAction |
The types of move and delete actions that are supported. The possible values are: moveToJunk , moveToInbox , hardDelete , softDelete , moveToDeletedItems , unknownFutureValue . |
remediateSendersCopy |
Boolean |
For internal or outbound email, indicates whether to remediate the sender's copy of an email. |
analyzedEmails |
microsoft.graph.security.analyzedEmail collection |
Contains the networkMessageId and recipientEmailAddress values of the analyzed emails. |
Response
If successful, this action returns a 202 Accepted
response code and a Location
header with a link to the tracking information.
Note: The response to the action can be tracked in https://security.microsoft.com/action-center/history. To learn more, see Use the Action center.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/security/collaboration/analyzedEmails/remediate
Content-Type: application/json
{
"displayName": "Clean up Phish email",
"description": "Delete email",
"severity": "medium",
"action": "softDelete",
"remediateSendersCopy": "false",
"analyzedEmails": [
{
"networkMessageId": "73ca4154-58d8-43d0-a890-08dc18c52e6d",
"recipientEmailAddress": "hannah.jarvis@contoso.com"
},
{
"networkMessageId": "73ca4154-58d8-43d0-a890-08dc18c52e6d",
"recipientEmailAddress": "preston.morales@contoso.com"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Security.Collaboration.AnalyzedEmails.MicrosoftGraphSecurityRemediate;
using Microsoft.Graph.Beta.Models.Security;
var requestBody = new RemediatePostRequestBody
{
DisplayName = "Clean up Phish email",
Description = "Delete email",
Severity = RemediationSeverity.Medium,
Action = RemediationAction.SoftDelete,
RemediateSendersCopy = false,
AnalyzedEmails = new List<AnalyzedEmail>
{
new AnalyzedEmail
{
NetworkMessageId = "73ca4154-58d8-43d0-a890-08dc18c52e6d",
RecipientEmailAddress = "hannah.jarvis@contoso.com",
},
new AnalyzedEmail
{
NetworkMessageId = "73ca4154-58d8-43d0-a890-08dc18c52e6d",
RecipientEmailAddress = "preston.morales@contoso.com",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Security.Collaboration.AnalyzedEmails.MicrosoftGraphSecurityRemediate.PostAsync(requestBody);
mgc-beta security collaboration analyzed-emails microsoft-graph-security-remediate post --body '{\
"displayName": "Clean up Phish email",\
"description": "Delete email",\
"severity": "medium",\
"action": "softDelete",\
"remediateSendersCopy": "false",\
"analyzedEmails": [\
{\
"networkMessageId": "73ca4154-58d8-43d0-a890-08dc18c52e6d",\
"recipientEmailAddress": "hannah.jarvis@contoso.com"\
},\
{\
"networkMessageId": "73ca4154-58d8-43d0-a890-08dc18c52e6d",\
"recipientEmailAddress": "preston.morales@contoso.com"\
}\
]\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphsecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/security"
graphmodelssecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/models/security"
//other-imports
)
requestBody := graphsecurity.NewRemediatePostRequestBody()
displayName := "Clean up Phish email"
requestBody.SetDisplayName(&displayName)
description := "Delete email"
requestBody.SetDescription(&description)
severity := graphmodels.MEDIUM_REMEDIATIONSEVERITY
requestBody.SetSeverity(&severity)
action := graphmodels.SOFTDELETE_REMEDIATIONACTION
requestBody.SetAction(&action)
remediateSendersCopy := false
requestBody.SetRemediateSendersCopy(&remediateSendersCopy)
analyzedEmail := graphmodelssecurity.NewAnalyzedEmail()
networkMessageId := "73ca4154-58d8-43d0-a890-08dc18c52e6d"
analyzedEmail.SetNetworkMessageId(&networkMessageId)
recipientEmailAddress := "hannah.jarvis@contoso.com"
analyzedEmail.SetRecipientEmailAddress(&recipientEmailAddress)
analyzedEmail1 := graphmodelssecurity.NewAnalyzedEmail()
networkMessageId := "73ca4154-58d8-43d0-a890-08dc18c52e6d"
analyzedEmail1.SetNetworkMessageId(&networkMessageId)
recipientEmailAddress := "preston.morales@contoso.com"
analyzedEmail1.SetRecipientEmailAddress(&recipientEmailAddress)
analyzedEmails := []graphmodelssecurity.AnalyzedEmailable {
analyzedEmail,
analyzedEmail1,
}
requestBody.SetAnalyzedEmails(analyzedEmails)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Security().Collaboration().AnalyzedEmails().MicrosoftGraphSecurityRemediate().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.security.collaboration.analyzedemails.microsoftgraphsecurityremediate.RemediatePostRequestBody remediatePostRequestBody = new com.microsoft.graph.beta.security.collaboration.analyzedemails.microsoftgraphsecurityremediate.RemediatePostRequestBody();
remediatePostRequestBody.setDisplayName("Clean up Phish email");
remediatePostRequestBody.setDescription("Delete email");
remediatePostRequestBody.setSeverity(com.microsoft.graph.beta.models.security.RemediationSeverity.Medium);
remediatePostRequestBody.setAction(com.microsoft.graph.beta.models.security.RemediationAction.SoftDelete);
remediatePostRequestBody.setRemediateSendersCopy(false);
LinkedList<com.microsoft.graph.beta.models.security.AnalyzedEmail> analyzedEmails = new LinkedList<com.microsoft.graph.beta.models.security.AnalyzedEmail>();
com.microsoft.graph.beta.models.security.AnalyzedEmail analyzedEmail = new com.microsoft.graph.beta.models.security.AnalyzedEmail();
analyzedEmail.setNetworkMessageId("73ca4154-58d8-43d0-a890-08dc18c52e6d");
analyzedEmail.setRecipientEmailAddress("hannah.jarvis@contoso.com");
analyzedEmails.add(analyzedEmail);
com.microsoft.graph.beta.models.security.AnalyzedEmail analyzedEmail1 = new com.microsoft.graph.beta.models.security.AnalyzedEmail();
analyzedEmail1.setNetworkMessageId("73ca4154-58d8-43d0-a890-08dc18c52e6d");
analyzedEmail1.setRecipientEmailAddress("preston.morales@contoso.com");
analyzedEmails.add(analyzedEmail1);
remediatePostRequestBody.setAnalyzedEmails(analyzedEmails);
graphClient.security().collaboration().analyzedEmails().microsoftGraphSecurityRemediate().post(remediatePostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const remediate = {
displayName: 'Clean up Phish email',
description: 'Delete email',
severity: 'medium',
action: 'softDelete',
remediateSendersCopy: 'false',
analyzedEmails: [
{
networkMessageId: '73ca4154-58d8-43d0-a890-08dc18c52e6d',
recipientEmailAddress: 'hannah.jarvis@contoso.com'
},
{
networkMessageId: '73ca4154-58d8-43d0-a890-08dc18c52e6d',
recipientEmailAddress: 'preston.morales@contoso.com'
}
]
};
await client.api('/security/collaboration/analyzedEmails/remediate')
.version('beta')
.post(remediate);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Security\Collaboration\AnalyzedEmails\MicrosoftGraphSecurityRemediate\RemediatePostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Security\RemediationSeverity;
use Microsoft\Graph\Beta\Generated\Models\Security\RemediationAction;
use Microsoft\Graph\Beta\Generated\Models\Security\AnalyzedEmail;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RemediatePostRequestBody();
$requestBody->setDisplayName('Clean up Phish email');
$requestBody->setDescription('Delete email');
$requestBody->setSeverity(new RemediationSeverity('medium'));
$requestBody->setAction(new RemediationAction('softDelete'));
$requestBody->setRemediateSendersCopy(false);
$analyzedEmailsAnalyzedEmail1 = new AnalyzedEmail();
$analyzedEmailsAnalyzedEmail1->setNetworkMessageId('73ca4154-58d8-43d0-a890-08dc18c52e6d');
$analyzedEmailsAnalyzedEmail1->setRecipientEmailAddress('hannah.jarvis@contoso.com');
$analyzedEmailsArray []= $analyzedEmailsAnalyzedEmail1;
$analyzedEmailsAnalyzedEmail2 = new AnalyzedEmail();
$analyzedEmailsAnalyzedEmail2->setNetworkMessageId('73ca4154-58d8-43d0-a890-08dc18c52e6d');
$analyzedEmailsAnalyzedEmail2->setRecipientEmailAddress('preston.morales@contoso.com');
$analyzedEmailsArray []= $analyzedEmailsAnalyzedEmail2;
$requestBody->setAnalyzedEmails($analyzedEmailsArray);
$graphServiceClient->security()->collaboration()->analyzedEmails()->microsoftGraphSecurityRemediate()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Security
$params = @{
displayName = "Clean up Phish email"
description = "Delete email"
severity = "medium"
action = "softDelete"
remediateSendersCopy = "false"
analyzedEmails = @(
@{
networkMessageId = "73ca4154-58d8-43d0-a890-08dc18c52e6d"
recipientEmailAddress = "hannah.jarvis@contoso.com"
}
@{
networkMessageId = "73ca4154-58d8-43d0-a890-08dc18c52e6d"
recipientEmailAddress = "preston.morales@contoso.com"
}
)
}
Invoke-MgBetaRemediateSecurityCollaborationAnalyzedEmail -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.security.collaboration.analyzedemails.microsoft_graph_security_remediate.remediate_post_request_body import RemediatePostRequestBody
from msgraph_beta.generated.models.remediation_severity import RemediationSeverity
from msgraph_beta.generated.models.remediation_action import RemediationAction
from msgraph_beta.generated.models.security.analyzed_email import AnalyzedEmail
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RemediatePostRequestBody(
display_name = "Clean up Phish email",
description = "Delete email",
severity = RemediationSeverity.Medium,
action = RemediationAction.SoftDelete,
remediate_senders_copy = False,
analyzed_emails = [
AnalyzedEmail(
network_message_id = "73ca4154-58d8-43d0-a890-08dc18c52e6d",
recipient_email_address = "hannah.jarvis@contoso.com",
),
AnalyzedEmail(
network_message_id = "73ca4154-58d8-43d0-a890-08dc18c52e6d",
recipient_email_address = "preston.morales@contoso.com",
),
],
)
await graph_client.security.collaboration.analyzed_emails.microsoft_graph_security_remediate.post(request_body)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 202 Accepted
Location: https://security.microsoft.com/action-center/history?filters={"bulkId":["{bulkId}"]}&tid={tid}
Content-Type: application/json;text/plain
Content-Length: 0