Create threatAssessmentRequest
Article
10/27/2023
8 contributors
Feedback
In this article
Create a new threat assessment request.
A threat assessment request can be one of the following types:
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)
ThreatAssessment.ReadWrite.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Not supported.
Not supported.
HTTP request
POST /informationProtection/threatAssessmentRequests
Name
Description
Authorization
Bearer {token}. Required.
Request body
In the request body, supply a JSON representation of a threatAssessmentRequest object.
Response
If successful, this method returns a 201 Created
response code and a new threatAssessmentRequest object in the response body.
Examples
Example 1: Create a mail assessment request
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.mailAssessmentRequest",
"recipientEmail": "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",
"expectedAssessment": "block",
"category": "spam",
"messageUri": "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt="
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new MailAssessmentRequest
{
OdataType = "#microsoft.graph.mailAssessmentRequest",
RecipientEmail = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",
ExpectedAssessment = ThreatExpectedAssessment.Block,
Category = ThreatCategory.Spam,
MessageUri = "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt=",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.InformationProtection.ThreatAssessmentRequests.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc information-protection threat-assessment-requests create --body '{\
"@odata.type": "#microsoft.graph.mailAssessmentRequest",\
"recipientEmail": "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",\
"expectedAssessment": "block",\
"category": "spam",\
"messageUri": "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt="\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewThreatAssessmentRequest()
recipientEmail := "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com"
requestBody.SetRecipientEmail(&recipientEmail)
expectedAssessment := graphmodels.BLOCK_THREATEXPECTEDASSESSMENT
requestBody.SetExpectedAssessment(&expectedAssessment)
category := graphmodels.SPAM_THREATCATEGORY
requestBody.SetCategory(&category)
messageUri := "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt="
requestBody.SetMessageUri(&messageUri)
threatAssessmentRequests, err := graphClient.InformationProtection().ThreatAssessmentRequests().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 .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
MailAssessmentRequest threatAssessmentRequest = new MailAssessmentRequest();
threatAssessmentRequest.recipientEmail = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com";
threatAssessmentRequest.expectedAssessment = ThreatExpectedAssessment.BLOCK;
threatAssessmentRequest.category = ThreatCategory.SPAM;
threatAssessmentRequest.messageUri = "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt=";
graphClient.informationProtection().threatAssessmentRequests()
.buildRequest()
.post(threatAssessmentRequest);
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 threatAssessmentRequest = {
'@odata.type': '#microsoft.graph.mailAssessmentRequest',
recipientEmail: 'tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com',
expectedAssessment: 'block',
category: 'spam',
messageUri: 'https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt='
};
await client.api('/informationProtection/threatAssessmentRequests')
.post(threatAssessmentRequest);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new MailAssessmentRequest();
$requestBody->setOdataType('#microsoft.graph.mailAssessmentRequest');
$requestBody->setRecipientEmail('tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com');
$requestBody->setExpectedAssessment(new ThreatExpectedAssessment('block'));
$requestBody->setCategory(new ThreatCategory('spam'));
$requestBody->setMessageUri('https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt=');
$result = $graphServiceClient->informationProtection()->threatAssessmentRequests()->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.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.mailAssessmentRequest"
recipientEmail = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com"
expectedAssessment = "block"
category = "spam"
messageUri = "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt="
}
New-MgInformationProtectionThreatAssessmentRequest -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(credentials, scopes)
request_body = MailAssessmentRequest(
odata_type = "#microsoft.graph.mailAssessmentRequest",
recipient_email = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",
expected_assessment = ThreatExpectedAssessment.Block,
category = ThreatCategory.Spam,
message_uri = "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt=",
)
result = await graph_client.information_protection.threat_assessment_requests.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
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#informationProtection/threatAssessmentRequests/$entity",
"@odata.type": "#microsoft.graph.mailAssessmentRequest",
"id": "49c5ef5b-1f65-444a-e6b9-08d772ea2059",
"createdDateTime": "2019-11-27T03:30:18.6890937Z",
"contentType": "mail",
"expectedAssessment": "block",
"category": "spam",
"status": "pending",
"requestSource": "administrator",
"recipientEmail": "tifc@a830edad9050849eqtpwbjzxodq.onmicrosoft.com",
"destinationRoutingReason": "notJunk",
"messageUri": "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt=",
"createdBy": {
"user": {
"id": "c52ce8db-3e4b-4181-93c4-7d6b6bffaf60",
"displayName": "Ronald Admin"
}
}
}
Example 2: Create an email assessment request
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.emailFileAssessmentRequest",
"recipientEmail": "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",
"expectedAssessment": "block",
"category": "malware",
"contentData": "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC....."
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new EmailFileAssessmentRequest
{
OdataType = "#microsoft.graph.emailFileAssessmentRequest",
RecipientEmail = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",
ExpectedAssessment = ThreatExpectedAssessment.Block,
Category = ThreatCategory.Malware,
ContentData = "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.InformationProtection.ThreatAssessmentRequests.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc information-protection threat-assessment-requests create --body '{\
"@odata.type": "#microsoft.graph.emailFileAssessmentRequest",\
"recipientEmail": "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",\
"expectedAssessment": "block",\
"category": "malware",\
"contentData": "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC....."\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewThreatAssessmentRequest()
recipientEmail := "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com"
requestBody.SetRecipientEmail(&recipientEmail)
expectedAssessment := graphmodels.BLOCK_THREATEXPECTEDASSESSMENT
requestBody.SetExpectedAssessment(&expectedAssessment)
category := graphmodels.MALWARE_THREATCATEGORY
requestBody.SetCategory(&category)
contentData := "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC....."
requestBody.SetContentData(&contentData)
threatAssessmentRequests, err := graphClient.InformationProtection().ThreatAssessmentRequests().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 .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
EmailFileAssessmentRequest threatAssessmentRequest = new EmailFileAssessmentRequest();
threatAssessmentRequest.recipientEmail = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com";
threatAssessmentRequest.expectedAssessment = ThreatExpectedAssessment.BLOCK;
threatAssessmentRequest.category = ThreatCategory.MALWARE;
threatAssessmentRequest.contentData = "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....";
graphClient.informationProtection().threatAssessmentRequests()
.buildRequest()
.post(threatAssessmentRequest);
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 threatAssessmentRequest = {
'@odata.type': '#microsoft.graph.emailFileAssessmentRequest',
recipientEmail: 'tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com',
expectedAssessment: 'block',
category: 'malware',
contentData: 'UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....'
};
await client.api('/informationProtection/threatAssessmentRequests')
.post(threatAssessmentRequest);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EmailFileAssessmentRequest();
$requestBody->setOdataType('#microsoft.graph.emailFileAssessmentRequest');
$requestBody->setRecipientEmail('tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com');
$requestBody->setExpectedAssessment(new ThreatExpectedAssessment('block'));
$requestBody->setCategory(new ThreatCategory('malware'));
$requestBody->setContentData('UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....');
$result = $graphServiceClient->informationProtection()->threatAssessmentRequests()->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.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.emailFileAssessmentRequest"
recipientEmail = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com"
expectedAssessment = "block"
category = "malware"
contentData = "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC....."
}
New-MgInformationProtectionThreatAssessmentRequest -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(credentials, scopes)
request_body = EmailFileAssessmentRequest(
odata_type = "#microsoft.graph.emailFileAssessmentRequest",
recipient_email = "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",
expected_assessment = ThreatExpectedAssessment.Block,
category = ThreatCategory.Malware,
content_data = "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....",
)
result = await graph_client.information_protection.threat_assessment_requests.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
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#informationProtection/threatAssessmentRequests/$entity",
"@odata.type": "#microsoft.graph.emailFileAssessmentRequest",
"id": "ab2ad9b3-2213-4091-ae0c-08d76ddbcacf",
"createdDateTime": "2019-11-20T17:05:06.4088076Z",
"contentType": "mail",
"expectedAssessment": "block",
"category": "malware",
"status": "completed",
"requestSource": "administrator",
"recipientEmail": "tifc@a830edad9050849EQTPWBJZXODQ.onmicrosoft.com",
"destinationRoutingReason": "notJunk",
"contentData": "",
"createdBy": {
"user": {
"id": "c52ce8db-3e4b-4181-93c4-7d6b6bffaf60",
"displayName": "Ronald Admin"
}
}
}
Example 3: Create a file assessment request
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.fileAssessmentRequest",
"expectedAssessment": "block",
"category": "malware",
"fileName": "test.txt",
"contentData": "VGhpcyBpcyBhIHRlc3QgZmlsZQ=="
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new FileAssessmentRequest
{
OdataType = "#microsoft.graph.fileAssessmentRequest",
ExpectedAssessment = ThreatExpectedAssessment.Block,
Category = ThreatCategory.Malware,
FileName = "test.txt",
ContentData = "VGhpcyBpcyBhIHRlc3QgZmlsZQ==",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.InformationProtection.ThreatAssessmentRequests.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc information-protection threat-assessment-requests create --body '{\
"@odata.type": "#microsoft.graph.fileAssessmentRequest",\
"expectedAssessment": "block",\
"category": "malware",\
"fileName": "test.txt",\
"contentData": "VGhpcyBpcyBhIHRlc3QgZmlsZQ=="\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewThreatAssessmentRequest()
expectedAssessment := graphmodels.BLOCK_THREATEXPECTEDASSESSMENT
requestBody.SetExpectedAssessment(&expectedAssessment)
category := graphmodels.MALWARE_THREATCATEGORY
requestBody.SetCategory(&category)
fileName := "test.txt"
requestBody.SetFileName(&fileName)
contentData := "VGhpcyBpcyBhIHRlc3QgZmlsZQ=="
requestBody.SetContentData(&contentData)
threatAssessmentRequests, err := graphClient.InformationProtection().ThreatAssessmentRequests().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 .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
FileAssessmentRequest threatAssessmentRequest = new FileAssessmentRequest();
threatAssessmentRequest.expectedAssessment = ThreatExpectedAssessment.BLOCK;
threatAssessmentRequest.category = ThreatCategory.MALWARE;
threatAssessmentRequest.fileName = "test.txt";
threatAssessmentRequest.contentData = "VGhpcyBpcyBhIHRlc3QgZmlsZQ==";
graphClient.informationProtection().threatAssessmentRequests()
.buildRequest()
.post(threatAssessmentRequest);
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 threatAssessmentRequest = {
'@odata.type': '#microsoft.graph.fileAssessmentRequest',
expectedAssessment: 'block',
category: 'malware',
fileName: 'test.txt',
contentData: 'VGhpcyBpcyBhIHRlc3QgZmlsZQ=='
};
await client.api('/informationProtection/threatAssessmentRequests')
.post(threatAssessmentRequest);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new FileAssessmentRequest();
$requestBody->setOdataType('#microsoft.graph.fileAssessmentRequest');
$requestBody->setExpectedAssessment(new ThreatExpectedAssessment('block'));
$requestBody->setCategory(new ThreatCategory('malware'));
$requestBody->setFileName('test.txt');
$requestBody->setContentData('VGhpcyBpcyBhIHRlc3QgZmlsZQ==');
$result = $graphServiceClient->informationProtection()->threatAssessmentRequests()->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.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.fileAssessmentRequest"
expectedAssessment = "block"
category = "malware"
fileName = "test.txt"
contentData = "VGhpcyBpcyBhIHRlc3QgZmlsZQ=="
}
New-MgInformationProtectionThreatAssessmentRequest -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(credentials, scopes)
request_body = FileAssessmentRequest(
odata_type = "#microsoft.graph.fileAssessmentRequest",
expected_assessment = ThreatExpectedAssessment.Block,
category = ThreatCategory.Malware,
file_name = "test.txt",
content_data = "VGhpcyBpcyBhIHRlc3QgZmlsZQ==",
)
result = await graph_client.information_protection.threat_assessment_requests.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
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#informationProtection/threatAssessmentRequests/$entity",
"@odata.type": "#microsoft.graph.fileAssessmentRequest",
"id": "18406a56-7209-4720-a250-08d772fccdaa",
"createdDateTime": "2019-11-27T05:44:00.4051536Z",
"contentType": "file",
"expectedAssessment": "block",
"category": "malware",
"status": "completed",
"requestSource": "administrator",
"fileName": "b3d5b715-4b88-4bbb-b0ae-9a9281a3f18a.csv",
"contentData": "",
"createdBy": {
"user": {
"id": "c52ce8db-3e4b-4181-93c4-7d6b6bffaf60",
"displayName": "Ronald Admin"
}
}
}
Example 4: Create an url assessment request
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.urlAssessmentRequest",
"url": "http://test.com",
"expectedAssessment": "block",
"category": "phishing"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new UrlAssessmentRequest
{
OdataType = "#microsoft.graph.urlAssessmentRequest",
Url = "http://test.com",
ExpectedAssessment = ThreatExpectedAssessment.Block,
Category = ThreatCategory.Phishing,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.InformationProtection.ThreatAssessmentRequests.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc information-protection threat-assessment-requests create --body '{\
"@odata.type": "#microsoft.graph.urlAssessmentRequest",\
"url": "http://test.com",\
"expectedAssessment": "block",\
"category": "phishing"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewThreatAssessmentRequest()
url := "http://test.com"
requestBody.SetUrl(&url)
expectedAssessment := graphmodels.BLOCK_THREATEXPECTEDASSESSMENT
requestBody.SetExpectedAssessment(&expectedAssessment)
category := graphmodels.PHISHING_THREATCATEGORY
requestBody.SetCategory(&category)
threatAssessmentRequests, err := graphClient.InformationProtection().ThreatAssessmentRequests().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 .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
UrlAssessmentRequest threatAssessmentRequest = new UrlAssessmentRequest();
threatAssessmentRequest.url = "http://test.com";
threatAssessmentRequest.expectedAssessment = ThreatExpectedAssessment.BLOCK;
threatAssessmentRequest.category = ThreatCategory.PHISHING;
graphClient.informationProtection().threatAssessmentRequests()
.buildRequest()
.post(threatAssessmentRequest);
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 threatAssessmentRequest = {
'@odata.type': '#microsoft.graph.urlAssessmentRequest',
url: 'http://test.com',
expectedAssessment: 'block',
category: 'phishing'
};
await client.api('/informationProtection/threatAssessmentRequests')
.post(threatAssessmentRequest);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UrlAssessmentRequest();
$requestBody->setOdataType('#microsoft.graph.urlAssessmentRequest');
$requestBody->setUrl('http://test.com');
$requestBody->setExpectedAssessment(new ThreatExpectedAssessment('block'));
$requestBody->setCategory(new ThreatCategory('phishing'));
$result = $graphServiceClient->informationProtection()->threatAssessmentRequests()->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.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.urlAssessmentRequest"
url = "http://test.com"
expectedAssessment = "block"
category = "phishing"
}
New-MgInformationProtectionThreatAssessmentRequest -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(credentials, scopes)
request_body = UrlAssessmentRequest(
odata_type = "#microsoft.graph.urlAssessmentRequest",
url = "http://test.com",
expected_assessment = ThreatExpectedAssessment.Block,
category = ThreatCategory.Phishing,
)
result = await graph_client.information_protection.threat_assessment_requests.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
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#informationProtection/threatAssessmentRequests/$entity",
"@odata.type": "#microsoft.graph.urlAssessmentRequest",
"id": "8d87d2b2-ca4d-422c-f8df-08d774a5c9ac",
"createdDateTime": "2019-11-29T08:26:09.8196703Z",
"contentType": "url",
"expectedAssessment": "block",
"category": "phishing",
"status": "pending",
"requestSource": "administrator",
"url": "http://test.com",
"createdBy": {
"user": {
"id": "c52ce8db-3e4b-4181-93c4-7d6b6bffaf60",
"displayName": "Ronald Admin"
}
}
}