删除附件Delete attachment

命名空间:microsoft.graphNamespace: microsoft.graph

从用户日历事件、邮件消息或组帖子中删除附件。Delete an attachment from a user calendar event, mail message, or group post.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限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.
  • 如果访问组帖子中的附件: Group. 全部。If accessing attachments in group posts: Group.ReadWrite.All.

HTTP 请求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 belonging to the user.

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

属于用户的默认 calendarGroup日历 中的 事件 附件。Attachments for an event in a calendar belonging to the user's default calendarGroup.

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

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

属于用户的 calendarGroup日历 中的 事件 附件。Attachments for an event in a calendar belonging 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}

用户邮箱的顶级 mailFolder 中包含的 邮件 附件。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}

用户邮箱的 mailFolder 的子文件夹中包含的 邮件 附件。下面的示例显示了一个嵌套级别,但邮件可能位于子级的子级中,诸如此类。 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 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
AuthorizationAuthorization stringstring Bearer {token}。必需。Bearer {token}. Required.

请求正文Request body

请勿提供此方法的请求正文。Do not supply a request body for this method.

响应Response

如果成功,此方法返回 204 No Content 响应代码。它不在响应正文中返回任何内容。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/v1.0/me/events/{id}/attachments/{id}
响应Response

下面是一个响应示例。Here is an example of the response.

HTTP/1.1 204 No Content