Edit

chatMessage: softDelete

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Delete a single chatMessage or a chat message reply in a channel or a chat.

Note: This API works differently in one or more national clouds. For details, see Implementation differences in national clouds.

This API is available in the following national cloud deployments.

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

Permissions

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

Permissions for channel

Permission type Permissions (from least to most privileged)
Delegated (work or school account) ChannelMessage.ReadWrite
Delegated (personal Microsoft account) Not supported.
Application Not supported.

Permissions for chat

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Chat.ReadWrite
Delegated (personal Microsoft account) Not supported.
Application Not supported.

Permissions for chat replies

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Chat.ReadWrite Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

HTTP request

To delete a chatMessage in a channel:

POST /teams/{teamsId}/channels/{channelId}/messages/{chatMessageId}/softDelete
POST /teams/{teamId}/channels/{channelId}/messages/{messageId}/replies/{replyId}/softDelete

To delete a chatMessage in a chat:

POST /users/{userId}/chats/{chatsId}/messages/{chatMessageId}/softDelete

To delete a reply to a message in a chat:

POST /chats/{chat-id}/messages/{message-id}/replies/{reply-id}/softDelete

Use the root message ID as {message-id} and the reply ID as {reply-id}. The reply must belong to the specified root message. This operation uses the chat-scoped URL; the user-scoped reply soft-delete URL isn't supported.

Note

Chat reply endpoints are currently supported only for bot sessions (bot conversations).

Request headers

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

Request body

Don't supply a request body for this method.

Response

If successful, this action returns a 204 No Content response code.

Examples

Example 1: Soft-delete message in a chat

Request

POST https://graph.microsoft.com/beta/users/8f98f01d-1a73-401a-b9e9-9fd1e6f5e5ar/chats/19:22273db3497f4b32bue61f6e82be21c5@thread.tacv2/messages/1649864053377/softDelete

Response

HTTP/1.1 204 No Content

Example 2: Soft-delete message in a channel

Request

POST https://graph.microsoft.com/beta/teams/172b0cce-e65d-44ce-9a49-91d9f2e8593a/channels/19:22273db3497f4b32bue61f6e82be21c5@thread.tacv2/messages/1649864053377/softDelete

Response

HTTP/1.1 204 No Content

Example 3: Soft-delete message of a reply

Request

POST https://graph.microsoft.com/beta/teams/172b0cce-e65d-44ce-9a49-91d9f2e8593a/channels/19:22273db3497f4b32bue61f6e82be21c5@thread.tacv2/messages/1649864053377/replies/1649852161658/softDelete

Response

HTTP/1.1 204 No Content

Example 4: Soft-delete a reply to a message in a chat

The following example shows how to soft-delete a reply to a message in a chat.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/chats/19:8b13f6c95f8b4e39a2e79fce14f205a1@thread.v2/messages/1757077200000/replies/1757077260000/softDelete

Response

The following example shows the response.

HTTP/1.1 204 No Content