Delete attachment

Namespace: microsoft.graph

Delete an attachment from a user calendar event, mail message, or group post.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Depending on the resource (event, message, outlookTask, or post) that the attachment is attached to and the permission type (delegated or application) requested, the permission specified in the following table is the least privileged required to call this API. To learn more, including taking caution before choosing more privileged permissions, search for the following permissions in Permissions.

Supported resource Delegated (work or school account) Delegated (personal Microsoft account) Application
event Calendars.ReadWrite Calendars.ReadWrite Calendars.ReadWrite
message Mail.ReadWrite Mail.ReadWrite Mail.ReadWrite
post Group.ReadWrite.All Not supported Not supported

HTTP request

Attachments for an event in the user's default calendar.

DELETE /me/events/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/events/{id}/attachments/{id}

DELETE /me/calendar/events/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/calendar/events/{id}/attachments/{id}

Attachments for an event in the specified calendar that belongs to the user.

DELETE /me/calendars/{id}/events/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/calendars/{id}/events/{id}/attachments/{id}

Attachments for an event in a calendar that belongs to the user's default calendarGroup.

DELETE /me/calendars/{id}/events/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/calendars/{id}/events/{id}/attachments/{id}

Attachments for an event in a calendar that belongs to a user's calendarGroup.

DELETE /me/calendarGroups/{id}/calendars/{id}/events/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/calendarGroups/{id}/calendars/{id}/events/{id}/attachments/{id}

Attachments for a message in a user's mailbox.

DELETE /me/messages/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/messages/{id}/attachments/{id}

Attachments for a message contained in a top level mailFolder in a user's mailbox.

DELETE /me/mailFolders/{id}/messages/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/attachments/{id}

Attachments for a message contained in a child folder of a mailFolder in a user's mailbox. The following example shows one level of nesting, but a message can be located in a child of a child and so on.

DELETE /me/mailFolders/{id}/childFolders/{id}/.../messages/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/mailFolders/{id}/childFolders/{id}/messages/{id}/attachments/{id}

Attachments for a post in a thread thta belongs to a conversation of a group.

DELETE /groups/{id}/threads/{id}/posts/{id}/attachments/{id}
DELETE /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/attachments/{id}

Request headers

Name Type Description
Authorization string Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 204 No Content response code. It doesn't return anything in the response body.

Example

Request

The following example shows a request to delete an attachment on an event.

DELETE https://graph.microsoft.com/v1.0/me/events/{id}/attachments/{id}

Response

The following example shows the response.

HTTP/1.1 204 No Content