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.
Verwenden Sie @odata.type im Anforderungstext, um den Parametertyp von alertComment anzugeben, und geben Sie ein JSON-Objekt für den Parameter an. comment Sehen Sie sich das Beispiel an.
Parameter
Typ
Beschreibung
comment
String
Der hinzuzufügende Kommentar.
Antwort
Bei erfolgreicher Ausführung gibt die Methode einen 200 OK Antwortcode und eine aktualisierte Liste aller alertComment-Ressourcen für die angegebene Warnung zurück.
POST https://graph.microsoft.com/v1.0/security/alerts_v2/da637865765418431569_-773071023/comments
Content-Type: application/json
{
"@odata.type": "microsoft.graph.security.alertComment",
"comment": "Demo for docs"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models.Security;
var requestBody = new AlertComment
{
OdataType = "microsoft.graph.security.alertComment",
Comment = "Demo for docs",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Alerts_v2["{alert-id}"].Comments.PostAsCommentsPostResponseAsync(requestBody);
// 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"
graphmodelssecurity "github.com/microsoftgraph/msgraph-sdk-go/models/security"
//other-imports
)
requestBody := graphmodelssecurity.NewAlertComment()
comment := "Demo for docs"
requestBody.SetComment(&comment)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
comments, err := graphClient.Security().Alerts_v2().ByAlertId("alert-id").Comments().PostAsCommentsPostResponse(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.models.security.AlertComment alertComment = new com.microsoft.graph.models.security.AlertComment();
alertComment.setOdataType("microsoft.graph.security.alertComment");
alertComment.setComment("Demo for docs");
var result = graphClient.security().alertsV2().byAlertId("{alert-id}").comments().post(alertComment);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Security\AlertComment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AlertComment();
$requestBody->setOdataType('microsoft.graph.security.alertComment');
$requestBody->setComment('Demo for docs');
$result = $graphServiceClient->security()->alerts_v2()->byAlertId('alert-id')->comments()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.security.alert_comment import AlertComment
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AlertComment(
odata_type = "microsoft.graph.security.alertComment",
comment = "Demo for docs",
)
result = await graph_client.security.alerts_v2.by_alert_id('alert-id').comments.post(request_body)