删除附件

命名空间:microsoft.graph

从用户日历事件、邮件、便笺或组帖子中删除附件。

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ✅ ✅ ✅

权限

根据附件附加到的 资源 (事件、 消息、 便笺或 帖子) 以及 (委派的权限类型或请求的应用程序) ,下表中指定的权限是调用此 API 所需的最低特权。 若要了解其他信息, 在 特权权限之前要特别小心,在"权限" 中搜索。

支持的资源 委派(工作或学校帐户) 委派(个人 Microsoft 帐户) 应用程序
事件 Calendars.ReadWrite Calendars.ReadWrite Calendars.ReadWrite
邮件 Mail.ReadWrite Mail.ReadWrite Mail.ReadWrite
注释 ShortNotes.ReadWrite ShortNotes.ReadWrite ShortNotes.ReadWrite.All
帖子 Group.ReadWrite.All 不支持 不支持

HTTP 请求

用户的默认日历中的事件附件。

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}

指定日历中属于用户的事件的附件。

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

日历中属于用户默认 calendarGroup 的事件的附件。

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

日历中属于用户 calendarGroup 的事件的附件。

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

用户邮箱中的 邮件 附件。

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

用户邮箱的顶级 mailFolder 中包含的 邮件 附件。

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

用户邮箱的 mailFolder 的子文件夹中包含的 邮件 附件。 下面的示例显示了一个嵌套级别,但消息可以位于子级的子级中,依此类推。

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

用户邮箱中 便笺 的附件。

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

属于组对话的会话中帖子的附件。

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

请求标头

名称 类型 说明
Authorization string 持有者 {token}。 必填。 详细了解 身份验证和授权。

请求正文

请勿提供此方法的请求正文。

响应

如果成功,此方法返回 204 No Content 响应代码。 它不会返回响应正文中的任何内容。

示例

示例 1:删除事件附件

以下示例显示如何删除 事件上的附件。

请求

以下示例显示了一个请求。

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

响应

以下示例显示了相应的响应。

HTTP/1.1 204 No Content

示例 2:删除便笺附件

以下示例演示如何删除 笔记中的附件。

请求

以下示例显示了一个请求。

DELETE https://graph.microsoft.com/v1.0/me/notes/AAMkAGI2THVSAAA=/attachments/AAMkAGI2attach2

响应

以下示例显示了相应的响应。

HTTP/1.1 204 No Content