删除附件
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
警告
应更新将此功能与 Outlook 任务配合使用的现有应用,因为 Outlook 任务正在弃用。 有关详细信息 ,请参阅公共预览版中的 To Do API 。
从用户日历 事件、 邮件、 Outlook 任务或 帖子中删除附件。
此 API 可用于以下国家级云部署。
全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
权限
根据附件附加到的资源 (事件、 消息、 outlookTask 或 post) ,以及请求的权限类型 (委托或应用程序) ,下表中指定的权限是调用此 API 所需的最低特权。 若要了解其他信息, 在 特权权限之前要特别小心,在"权限" 中搜索。
支持的资源 | 委派(工作或学校帐户) | 委派(个人 Microsoft 帐户) | 应用程序 |
---|---|---|---|
事件 | Calendars.ReadWrite | Calendars.ReadWrite | Calendars.ReadWrite |
邮件 | Mail.ReadWrite | Mail.ReadWrite | Mail.ReadWrite |
outlookTask | Tasks.ReadWrite | Tasks.ReadWrite | 不支持 |
帖子 | 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}
Outlook 任务的附件。
DELETE /me/outlook/tasks/{id}/attachments/{id}
DELETE /users/{id}/outlook/tasks/{id}/attachments/{id}
DELETE /groups/{id}/threads/{id}/posts/{id}/attachments/{id}
DELETE /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/attachments/{id}
请求标头
名称 | 说明 |
---|---|
Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法返回 204 No Content
响应代码。 它不会在响应正文中返回任何内容。
示例
请求
以下示例显示了删除事件附件的请求。
DELETE https://graph.microsoft.com/beta/me/events/{id}/attachments/{id}
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈