Edit

Create case attachment

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.

Create an attachment for a case.

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 permission Higher privileged permissions
Delegated (work or school account) Not supported. Not supported.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

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:

  • Security Reader
  • Security Operator
  • Security Administrator

HTTP request

POST /security/caseManagement/cases/{caseId}/attachments

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the microsoft.graph.security.caseManagement.attachment object.

You can specify the following properties when creating an attachment.

Property Type Description
displayName String The display name of the resource. Required.
description String The description of the resource. Optional.
fileSize Int64 The size of the attachment in bytes. Optional.
fileExtension String The file extension of the attachment. Optional.
scanResult microsoft.graph.security.caseManagement.attachmentScanResult The malware scan result for the attachment. Required.
origin microsoft.graph.security.caseManagement.attachmentOrigin The origin reference for the attachment. Optional.

Response

If successful, this method returns a 201 Created response code and a microsoft.graph.security.caseManagement.attachment object in the response body.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/security/caseManagement/cases/{caseId}/attachments
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.security.caseManagement.attachment",
  "displayName": "Case MS-001 Attachment",
  "description": "Screenshot of suspicious sign-in activity",
  "fileSize": 1000,
  "fileExtension": "jpeg",
  "scanResult": "noThreatsFound",
  "origin": {
    "@odata.type": "microsoft.graph.security.caseManagement.attachmentOrigin",
    "resourceId": "987757fb-6ef4-1061-17e7-9de0d088e1dd",
    "resourceType": "case"
  }
}

Response

The following example shows the response.

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.security.caseManagement.attachment",
  "id": "1719f11c-21e9-acf2-85db-ade533556fba",
  "createdDateTime": "2026-05-20T11:12:28Z",
  "createdBy": "user@contoso.com",
  "lastModifiedDateTime": "2026-05-20T11:18:45Z",
  "lastModifiedBy": "user@contoso.com",
  "displayName": "Case MS-001 Attachment",
  "description": "Screenshot of suspicious sign-in activity",
  "fileSize": 1000,
  "fileExtension": "jpeg",
  "scanResult": "noThreatsFound",
  "origin": {
    "@odata.type": "microsoft.graph.security.caseManagement.attachmentOrigin",
    "resourceId": "987757fb-6ef4-1061-17e7-9de0d088e1dd",
    "resourceType": "case"
  }
}