Erstellen von threatAssessmentRequest
Artikel
10/27/2023
9 Mitwirkende
Feedback
In diesem Artikel
Erstellen Sie eine neue Anforderung zur Bedrohungsbewertung.
Eine Bedrohungsbewertungsanforderung kann einer der folgenden Typen sein:
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
Globaler Dienst
US Government L4
US Government L5 (DOD)
China, betrieben von 21Vianet
✅
❌
❌
❌
Berechtigungen
Wählen Sie für diese API die Als am wenigsten privilegierten Berechtigungen gekennzeichneten Berechtigungen aus. Verwenden Sie nur dann eine Berechtigung mit höheren Berechtigungen , wenn dies für Ihre App erforderlich ist . Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen . Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz .
Berechtigungstyp
Berechtigungen mit den geringsten Berechtigungen
Berechtigungen mit höheren Berechtigungen
Delegiert (Geschäfts-, Schul- oder Unikonto)
ThreatAssessment.ReadWrite.All
Nicht verfügbar.
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Nicht unterstützt
Anwendung
Nicht unterstützt
Nicht unterstützt
HTTP-Anforderung
POST /informationProtection/threatAssessmentRequests
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung eines threatAssessmentRequest-Objekts an.
Antwort
Bei erfolgreicher Ausführung gibt die Methode einen 201 Created
Antwortcode und ein neues threatAssessmentRequest-Objekt im Antworttext zurück.
Beispiele
Beispiel 1: Erstellen einer E-Mail-Bewertungsanforderung
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.mailAssessmentRequest",
"recipientEmail": "tifc@contoso.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@contoso.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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc information-protection threat-assessment-requests create --body '{\
"@odata.type": "#microsoft.graph.mailAssessmentRequest",\
"recipientEmail": "tifc@contoso.com",\
"expectedAssessment": "block",\
"category": "spam",\
"messageUri": "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt="\
}\
'
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
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@contoso.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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
MailAssessmentRequest threatAssessmentRequest = new MailAssessmentRequest();
threatAssessmentRequest.setOdataType("#microsoft.graph.mailAssessmentRequest");
threatAssessmentRequest.setRecipientEmail("tifc@contoso.com");
threatAssessmentRequest.setExpectedAssessment(ThreatExpectedAssessment.Block);
threatAssessmentRequest.setCategory(ThreatCategory.Spam);
threatAssessmentRequest.setMessageUri("https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt=");
ThreatAssessmentRequest result = graphClient.informationProtection().threatAssessmentRequests().post(threatAssessmentRequest);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
const options = {
authProvider,
};
const client = Client.init(options);
const threatAssessmentRequest = {
'@odata.type': '#microsoft.graph.mailAssessmentRequest',
recipientEmail: 'tifc@contoso.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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\MailAssessmentRequest;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new MailAssessmentRequest();
$requestBody->setOdataType('#microsoft.graph.mailAssessmentRequest');
$requestBody->setRecipientEmail('tifc@contoso.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();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.mailAssessmentRequest"
recipientEmail = "tifc@contoso.com"
expectedAssessment = "block"
category = "spam"
messageUri = "https://graph.microsoft.com/v1.0/users/c52ce8db-3e4b-4181-93c4-7d6b6bffaf60/messages/AAMkADU3MWUxOTU0LWNlOTEt="
}
New-MgInformationProtectionThreatAssessmentRequest -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
from msgraph import GraphServiceClient
from msgraph.generated.models.mail_assessment_request import MailAssessmentRequest
graph_client = GraphServiceClient(credentials, scopes)
request_body = MailAssessmentRequest(
odata_type = "#microsoft.graph.mailAssessmentRequest",
recipient_email = "tifc@contoso.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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
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@contoso.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"
}
}
}
Beispiel 2: Erstellen einer E-Mail-Bewertungsanforderung
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.emailFileAssessmentRequest",
"recipientEmail": "tifc@contoso.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@contoso.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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc information-protection threat-assessment-requests create --body '{\
"@odata.type": "#microsoft.graph.emailFileAssessmentRequest",\
"recipientEmail": "tifc@contoso.com",\
"expectedAssessment": "block",\
"category": "malware",\
"contentData": "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC....."\
}\
'
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
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@contoso.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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EmailFileAssessmentRequest threatAssessmentRequest = new EmailFileAssessmentRequest();
threatAssessmentRequest.setOdataType("#microsoft.graph.emailFileAssessmentRequest");
threatAssessmentRequest.setRecipientEmail("tifc@contoso.com");
threatAssessmentRequest.setExpectedAssessment(ThreatExpectedAssessment.Block);
threatAssessmentRequest.setCategory(ThreatCategory.Malware);
threatAssessmentRequest.setContentData("UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....");
ThreatAssessmentRequest result = graphClient.informationProtection().threatAssessmentRequests().post(threatAssessmentRequest);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
const options = {
authProvider,
};
const client = Client.init(options);
const threatAssessmentRequest = {
'@odata.type': '#microsoft.graph.emailFileAssessmentRequest',
recipientEmail: 'tifc@contoso.com',
expectedAssessment: 'block',
category: 'malware',
contentData: 'UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....'
};
await client.api('/informationProtection/threatAssessmentRequests')
.post(threatAssessmentRequest);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\EmailFileAssessmentRequest;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EmailFileAssessmentRequest();
$requestBody->setOdataType('#microsoft.graph.emailFileAssessmentRequest');
$requestBody->setRecipientEmail('tifc@contoso.com');
$requestBody->setExpectedAssessment(new ThreatExpectedAssessment('block'));
$requestBody->setCategory(new ThreatCategory('malware'));
$requestBody->setContentData('UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....');
$result = $graphServiceClient->informationProtection()->threatAssessmentRequests()->post($requestBody)->wait();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.emailFileAssessmentRequest"
recipientEmail = "tifc@contoso.com"
expectedAssessment = "block"
category = "malware"
contentData = "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC....."
}
New-MgInformationProtectionThreatAssessmentRequest -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
from msgraph import GraphServiceClient
from msgraph.generated.models.email_file_assessment_request import EmailFileAssessmentRequest
graph_client = GraphServiceClient(credentials, scopes)
request_body = EmailFileAssessmentRequest(
odata_type = "#microsoft.graph.emailFileAssessmentRequest",
recipient_email = "tifc@contoso.com",
expected_assessment = ThreatExpectedAssessment.Block,
category = ThreatCategory.Malware,
content_data = "UmVjZWl2ZWQ6IGZyb20gTVcyUFIwME1CMDMxNC5uYW1wcmQwMC.....",
)
result = await graph_client.information_protection.threat_assessment_requests.post(request_body)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
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@contoso.com",
"destinationRoutingReason": "notJunk",
"contentData": "",
"createdBy": {
"user": {
"id": "c52ce8db-3e4b-4181-93c4-7d6b6bffaf60",
"displayName": "Ronald Admin"
}
}
}
Beispiel 3: Erstellen einer Dateibewertungsanforderung
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
// 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=="\
}\
'
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
FileAssessmentRequest threatAssessmentRequest = new FileAssessmentRequest();
threatAssessmentRequest.setOdataType("#microsoft.graph.fileAssessmentRequest");
threatAssessmentRequest.setExpectedAssessment(ThreatExpectedAssessment.Block);
threatAssessmentRequest.setCategory(ThreatCategory.Malware);
threatAssessmentRequest.setFileName("test.txt");
threatAssessmentRequest.setContentData("VGhpcyBpcyBhIHRlc3QgZmlsZQ==");
ThreatAssessmentRequest result = graphClient.informationProtection().threatAssessmentRequests().post(threatAssessmentRequest);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\FileAssessmentRequest;
$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();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
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
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
from msgraph import GraphServiceClient
from msgraph.generated.models.file_assessment_request import FileAssessmentRequest
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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
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"
}
}
}
Beispiel 4: Erstellen einer URL-Bewertungsanforderung
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UrlAssessmentRequest threatAssessmentRequest = new UrlAssessmentRequest();
threatAssessmentRequest.setOdataType("#microsoft.graph.urlAssessmentRequest");
threatAssessmentRequest.setUrl("http://test.com");
threatAssessmentRequest.setExpectedAssessment(ThreatExpectedAssessment.Block);
threatAssessmentRequest.setCategory(ThreatCategory.Phishing);
ThreatAssessmentRequest result = graphClient.informationProtection().threatAssessmentRequests().post(threatAssessmentRequest);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\UrlAssessmentRequest;
$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();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
from msgraph import GraphServiceClient
from msgraph.generated.models.url_assessment_request import UrlAssessmentRequest
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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen , finden Sie in der SDK-Dokumentation .
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
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"
}
}
}