Skip to content

Commit 89b8def

Browse files
authored
Merge pull request #28215 from microsoftgraph/users/devjha/targetedmessages-apis
API doc for TargetedMessages
2 parents f817011 + 64eba4c commit 89b8def

15 files changed

Lines changed: 887 additions & 66 deletions
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: "Delete targetedChatMessage"
3+
description: "Delete a specific targeted message from a chat context."
4+
author: "devjha-ms"
5+
ms.date: 02/16/2026
6+
ms.localizationpriority: medium
7+
ms.subservice: "teams"
8+
doc_type: apiPageType
9+
---
10+
11+
# Delete targetedChatMessage
12+
13+
Namespace: microsoft.graph
14+
15+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
16+
17+
Delete a specific [targeted message](../resources/targetedchatmessage.md) from a chat context. Teams administrators can use this API to remove targeted messages from group chats.
18+
19+
## Permissions
20+
21+
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions [only if your app requires it](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
22+
23+
<!-- {
24+
"blockType": "permissions",
25+
"name": "chat-delete-targetedmessages-permissions"
26+
}
27+
-->
28+
[!INCLUDE [permissions-table](../includes/permissions/chat-delete-targetedmessages-permissions.md)]
29+
30+
## HTTP request
31+
32+
<!-- {
33+
"blockType": "ignored"
34+
}
35+
-->
36+
``` http
37+
DELETE /users/{user-id | userPrincipalName}/chats/{chat-id}/targetedMessages/{message-id}
38+
```
39+
40+
## Path parameters
41+
42+
|Parameter|Type|Description|
43+
|:---|:---|:---|
44+
|chat-id|String|Placeholder for the unique identifier of the chat where the targeted message was sent. Required.|
45+
|message-id|String|Placeholder for the unique identifier of the targeted message to delete. This ID is unique within the context of the specified chat and user. Required.|
46+
|user-id|String|Placeholder for the unique identifier or user principal name of the user to whom the targeted message was sent. Required.|
47+
48+
## Request headers
49+
50+
|Name|Description|
51+
|:---|:---|
52+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
53+
54+
## Request body
55+
56+
Don't supply a request body for this method.
57+
58+
## Response
59+
60+
If successful, this method returns a `204 No Content` response code.
61+
62+
## Examples
63+
64+
### Request
65+
66+
The following example shows a request.
67+
68+
<!-- {
69+
"blockType": "request",
70+
"name": "delete_targetedchatmessage",
71+
"sampleKeys": ["f47b5f54-6968-4706-a522-31e842b12345", "19:eeaa4e946d674c4f8d4dded613780f45@thread.v2", "1580849738240"]
72+
}
73+
-->
74+
``` http
75+
DELETE https://graph.microsoft.com/beta/users/f47b5f54-6968-4706-a522-31e842b12345/chats/19:eeaa4e946d674c4f8d4dded613780f45@thread.v2/targetedMessages/1580849738240
76+
```
77+
78+
### Response
79+
80+
The following example shows the response.
81+
82+
<!-- {
83+
"blockType": "response",
84+
"truncated": true
85+
}
86+
-->
87+
``` http
88+
HTTP/1.1 204 No Content
89+
```
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: "userTeamwork: deleteTargetedMessage"
3+
description: "Delete a specific targeted message from a channel context."
4+
author: "devjha-ms"
5+
ms.date: 02/16/2026
6+
ms.localizationpriority: medium
7+
ms.subservice: "teams"
8+
doc_type: apiPageType
9+
---
10+
11+
# userTeamwork: deleteTargetedMessage
12+
13+
Namespace: microsoft.graph
14+
15+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
16+
17+
Delete a specific [targeted message](../resources/targetedchatmessage.md) from a channel context. Teams administrators can use this API to remove targeted messages by providing the message ID, team ID, and channel ID.
18+
19+
## Permissions
20+
21+
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions [only if your app requires it](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
22+
23+
<!-- {
24+
"blockType": "permissions",
25+
"name": "userteamwork-deletetargetedmessage-permissions"
26+
}
27+
-->
28+
[!INCLUDE [permissions-table](../includes/permissions/userteamwork-deletetargetedmessage-permissions.md)]
29+
30+
## HTTP request
31+
32+
<!-- {
33+
"blockType": "ignored"
34+
}
35+
-->
36+
``` http
37+
POST /users/{user-id | userPrincipalName}/teamwork/deleteTargetedMessage
38+
```
39+
40+
## Request headers
41+
42+
|Name|Description|
43+
|:---|:---|
44+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
45+
|Content-Type|application/json. Required.|
46+
47+
## Request body
48+
49+
In the request body, supply a JSON representation of the parameters.
50+
51+
The following table lists the parameters that are required when you call this action.
52+
53+
|Parameter|Type|Description|
54+
|:---|:---|:---|
55+
|channelId|String|The unique identifier of the channel where the targeted message was sent. Required.|
56+
|messageId|String|The unique identifier of the targeted message to delete. This ID is unique within the context of the specified channel and user. Required.|
57+
|teamId|String|The unique identifier of the team that contains the channel where the targeted message was sent. Required.|
58+
59+
## Response
60+
61+
If successful, this action returns a `204 No Content` response code.
62+
63+
## Examples
64+
65+
### Request
66+
67+
The following example shows a request.
68+
69+
<!-- {
70+
"blockType": "request",
71+
"name": "userteamwork_deletetargetedmessage",
72+
"sampleKeys": ["f47b5f54-6968-4706-a522-31e842b12345"]
73+
}
74+
-->
75+
``` http
76+
POST https://graph.microsoft.com/beta/users/f47b5f54-6968-4706-a522-31e842b12345/teamwork/deleteTargetedMessage
77+
Content-Type: application/json
78+
79+
{
80+
"teamId": "3Aeeaa4e946d674c4f8d4dded613780f45@thread.v2",
81+
"channelId": "19:eeaa4e946d674c4f8d4dded613780f45@thread.v2",
82+
"messageId": "1580849738240"
83+
}
84+
```
85+
86+
### Response
87+
88+
The following example shows the response.
89+
90+
<!-- {
91+
"blockType": "response",
92+
"truncated": true
93+
}
94+
-->
95+
``` http
96+
HTTP/1.1 204 No Content
97+
```
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
title: "userTeamwork: getAllRetainedTargetedMessages"
3+
description: "Get all retained targeted messages sent to a specific user in group chats and channels."
4+
author: "devjha-ms"
5+
ms.date: 02/16/2026
6+
ms.localizationpriority: medium
7+
ms.subservice: "teams"
8+
doc_type: apiPageType
9+
---
10+
11+
# userTeamwork: getAllRetainedTargetedMessages
12+
13+
Namespace: microsoft.graph
14+
15+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
16+
17+
Get all retained [targeted messages](../resources/targetedchatmessage.md) sent to a specific user in group chats and channels.
18+
19+
## Permissions
20+
21+
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions [only if your app requires it](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
22+
23+
<!-- {
24+
"blockType": "permissions",
25+
"name": "userteamwork-getallretainedtargetedmessages-permissions"
26+
}
27+
-->
28+
[!INCLUDE [permissions-table](../includes/permissions/userteamwork-getallretainedtargetedmessages-permissions.md)]
29+
30+
## HTTP request
31+
32+
<!-- {
33+
"blockType": "ignored"
34+
}
35+
-->
36+
``` http
37+
GET /users/{user-id | userPrincipalName}/teamwork/getAllRetainedTargetedMessages
38+
```
39+
40+
## Optional query parameters
41+
42+
This method supports the following OData query parameters to help customize the response. For general information, see [OData query parameters](/graph/query-parameters).
43+
44+
| Name |Description|
45+
|:--------|:----------|
46+
| $filter | The [$filter](/graph/query-parameters#filter-parameter) query parameter supports date and time range queries on the **lastModifiedDateTime** property using [date range parameters](/graph/query-parameters).|
47+
| $top | Use the [$top](/graph/query-parameters#top-parameter) query parameter to control the number of items per response.|
48+
49+
### Supported $filter operators
50+
51+
The following filter expressions are supported:
52+
53+
- `lastModifiedDateTime gt {datetime}` - Returns messages modified after the specified date and time.
54+
- `lastModifiedDateTime lt {datetime}` - Returns messages modified before the specified date and time.
55+
- `from/application/id eq '{id}'` - Returns messages sent by a specific application ID.
56+
57+
You can combine multiple filter expressions using the `and` operator. For example:
58+
```http
59+
GET /users/{user-id | userPrincipalName}/teamwork/getAllRetainedTargetedMessages?$filter=lastModifiedDateTime gt 2024-01-01T00:00:00Z and lastModifiedDateTime lt 2024-12-31T23:59:59Z
60+
```
61+
62+
## Request headers
63+
64+
|Name|Description|
65+
|:---|:---|
66+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
67+
68+
## Request body
69+
70+
Don't supply a request body for this method.
71+
72+
## Response
73+
74+
If successful, this function returns a `200 OK` response code and a collection of [targetedChatMessage](../resources/targetedchatmessage.md) objects in the response body.
75+
76+
The response includes the **@odata.nextLink** property for pagination, when applicable.
77+
78+
## Examples
79+
80+
### Request
81+
82+
The following example shows a request.
83+
84+
<!-- {
85+
"blockType": "request",
86+
"name": "userteamwork_getallretainedtargetedmessages",
87+
"sampleKeys": ["f47b5f54-6968-4706-a522-31e842b12345"]
88+
}
89+
-->
90+
``` http
91+
GET https://graph.microsoft.com/beta/users/f47b5f54-6968-4706-a522-31e842b12345/teamwork/getAllRetainedTargetedMessages
92+
```
93+
94+
### Response
95+
96+
The following example shows the response.
97+
98+
>**Note:** The response object shown here might be shortened for readability.
99+
100+
<!-- {
101+
"blockType": "response",
102+
"truncated": true,
103+
"@odata.type": "Collection(microsoft.graph.targetedChatMessage)"
104+
}
105+
-->
106+
``` http
107+
HTTP/1.1 200 OK
108+
Content-Type: application/json
109+
110+
{
111+
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(targetedChatMessage)",
112+
"@odata.count": 1,
113+
"@odata.nextLink": "https://graph.microsoft.com/beta/users/f47b5f54-6968-4706-a522-31e842b12345/teamwork/getAllRetainedTargetedMessages?$top=1&$skiptoken=Token",
114+
"value": [
115+
{
116+
"@odata.type": "#microsoft.graph.targetedChatMessage",
117+
"id": "1684961612345",
118+
"replyToId": null,
119+
"etag": "1684962512345",
120+
"messageType": "message",
121+
"createdDateTime": "2023-05-24T20:54:49.858Z",
122+
"lastModifiedDateTime": "2023-05-24T21:13:15Z",
123+
"lastEditedDateTime": "2023-05-24T21:09:00.224Z",
124+
"deletedDateTime": null,
125+
"subject": "",
126+
"summary": null,
127+
"chatId": "19:1a546d42d8b54a16903716f49b512345@thread.v2",
128+
"importance": "normal",
129+
"locale": "en-us",
130+
"webUrl": null,
131+
"channelIdentity": null,
132+
"onBehalfOf": null,
133+
"policyViolation": null,
134+
"eventDetail": null,
135+
"from": {
136+
"device": null,
137+
"user": null,
138+
"application": {
139+
"@odata.type": "#microsoft.graph.teamworkApplicationIdentity",
140+
"id": "6d23e712-527b-406f-8d59-d02927885918",
141+
"displayName": "Breakthru",
142+
"applicationIdentityType": "bot"
143+
}
144+
},
145+
"body": {
146+
"contentType": "html",
147+
"content": "<p>5/24 group chat</p>"
148+
},
149+
"attachments": [],
150+
"mentions": [],
151+
"reactions": [],
152+
"messageHistory": [],
153+
"recipient": {
154+
"@odata.type": "#microsoft.graph.identity",
155+
"id": "1273a016-201d-4f95-8083-1b7f99b3edeb",
156+
"displayName": "Adele Vance"
157+
}
158+
}
159+
]
160+
}
161+
```

0 commit comments

Comments
 (0)