Namespace: microsoft.graph.security.caseManagement
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.
Update a comment activity in a case timeline. Only comment activities support update. Include @odata.type with #microsoft.graph.security.caseManagement.comment in the request body to identify the concrete activity type.
Important
You can't use this API to update comment activities for incidentCase objects.
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) |
CaseManagement.ReadWrite.All |
Not available. |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
CaseManagement.ReadWrite.All |
Not available. |
Important
For delegated access using work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role that grants the permissions required for this operation. This API supports the following built-in roles:
- Global Reader
- Security Reader
- Security Operator
- Security Administrator
HTTP request
PATCH /security/caseManagement/cases/{caseId}/activities/{activityId}
Request body
In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
Supply a JSON representation of the resource. Include @odata.type to identify the concrete activity type.
| Property |
Type |
Description |
| @odata.type |
String |
The OData type of the concrete activity. To update a comment, use #microsoft.graph.security.caseManagement.comment. |
| message |
String |
The comment body. |
Response
If successful, this method returns a 204 No Content response code.
Examples
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/security/caseManagement/cases/987757fb-6ef4-1061-17e7-9de0d088e1dd/activities/c5dcf8b0-0732-750b-0e35-7f44188423bf
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.security.caseManagement.comment",
"message": "This is a modified comment."
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.Security.CaseManagement;
var requestBody = new Comment
{
OdataType = "#microsoft.graph.security.caseManagement.comment",
Message = "This is a modified comment.",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.CaseManagement.Cases["{case-id}"].Activities["{activity-id}"].PatchAsync(requestBody);
// 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"
graphmodelssecuritycasemanagement "github.com/microsoftgraph/msgraph-beta-sdk-go/models/security/casemanagement"
//other-imports
)
requestBody := graphmodelssecuritycasemanagement.NewActivity()
message := "This is a modified comment."
requestBody.SetMessage(&message)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
activities, err := graphClient.Security().CaseManagement().Cases().ByCaseId("case-id").Activities().ByActivityId("activity-id").Patch(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.models.security.casemanagement.Comment activity = new com.microsoft.graph.beta.models.security.casemanagement.Comment();
activity.setOdataType("#microsoft.graph.security.caseManagement.comment");
activity.setMessage("This is a modified comment.");
com.microsoft.graph.models.security.casemanagement.Activity result = graphClient.security().caseManagement().cases().byCaseId("{case-id}").activities().byActivityId("{activity-id}").patch(activity);
const options = {
authProvider,
};
const client = Client.init(options);
const activity = {
'@odata.type': '#microsoft.graph.security.caseManagement.comment',
message: 'This is a modified comment.'
};
await client.api('/security/caseManagement/cases/987757fb-6ef4-1061-17e7-9de0d088e1dd/activities/c5dcf8b0-0732-750b-0e35-7f44188423bf')
.version('beta')
.update(activity);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Security\CaseManagement\Comment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Comment();
$requestBody->setOdataType('#microsoft.graph.security.caseManagement.comment');
$requestBody->setMessage('This is a modified comment.');
$result = $graphServiceClient->security()->caseManagement()->cases()->byCaseId('case-id')->activities()->byActivityId('activity-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Security
$params = @{
"@odata.type" = "#microsoft.graph.security.caseManagement.comment"
message = "This is a modified comment."
}
Update-MgBetaSecurityCaseManagementCaseActivity -CaseId $caseId -ActivityId $activityId -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.models.security.case_management.comment import Comment
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Comment(
odata_type = "#microsoft.graph.security.caseManagement.comment",
message = "This is a modified comment.",
)
result = await graph_client.security.case_management.cases.by_case_id('case-id').activities.by_activity_id('activity-id').patch(request_body)
Response
The following example shows the response.
HTTP/1.1 204 No Content