Delete attachment

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Delete an attachment from a calendar event, message, Outlook task, or post.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

  • If accessing attachments in messages: Mail.ReadWrite
  • If accessing attachments in events: Calendars.ReadWrite
  • If accessing attachments in Outlook tasks: Tasks.ReadWrite
  • If accessing attachments in group posts: Group.ReadWrite.All

HTTP request

Attachments for an event.

DELETE /me/events/{id}/attachments/{id}
DELETE /users/{id | userPrincipalName}/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 example below 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 an Outlook task.

DELETE /me/outlook/tasks/<id>/attachments/{id}
DELETE /users/<id>/outlook/tasks/<id>/attachments/{id}

Attachments for a post in a thread belonging 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.

Request body

Do not supply a request body for this method.

Response

If successful, this method returns 204 No Content response code. It does not return anything in the response body.

Example

Request

Here is an example of the request to delete an attachment on an event.

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

Response

Here is an example of the response.

HTTP/1.1 204 No Content