|
| 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