channel: getAllMessages
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.
Retrieve messages across all channels in a team, including text, audio, and video conversations.
To learn more about using the Microsoft Teams export APIs to export content, see Export content with the Microsoft Teams export APIs.
Note: This API has licensing and payment requirements. It supports both
model=Aandmodel=Bquery parameters. If no model is specified, evaluation mode will be used.
Permissions
The following permissions are required to call this API. To learn more, including how to choose permissions, see Permissions.
| Permission type | Permissions (from least to most privileged) |
|---|---|
| Delegated (work or school account) | Not supported |
| Delegated (personal Microsoft account) | Not supported |
| Application | ChannelMessage.Read.All |
Note
Before calling this API with application permissions, you must request access. For details, see Protected APIs in Microsoft Teams.
HTTP request
GET /teams/{team-id}/channels/getAllMessages
Optional query parameters
You can use model query parameter, which supports the values A and B, based on the preferred licensing and payment model,
as shown in the following examples.
If no model is specified, evaluation mode will be used.
GET /teams/{team-id}/channels/getAllMessages?model=A
GET /teams/{team-id}/channels/getAllMessages?model=B
If no model parameter is specified, evaluation mode will be used.
You can use the $top query parameter to control the number of items per response. Additionally, $filter is supported with dateTime range query on lastModifiedDateTime. The other OData query parameters are not currently supported.
Request body
Do not supply a request body for this method.
Response
If successful, this method returns a 200 OK response code and also returns all the messages in the channel.
Example
Request
The following is an example of the request.
GET https://graph.microsoft.com/beta/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/getAllMessages
Response
HTTP/1.1 200 OK
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(chatMessage)",
"@odata.count": 2,
"@odata.nextLink": "https://graph.microsoft.com/beta/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/getAllMessages?$skip=2",
"value": [
{
"@odata.type": "#microsoft.graph.chatMessage",
"id": "1616990417393",
"replyToId": null,
"etag": "1616990417393",
"messageType": "message",
"createdDateTime": "2021-03-29T04:00:17.393Z",
"lastModifiedDateTime": "2021-03-29T04:00:17.393Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": null,
"importance": "normal",
"locale": "en-us",
"webUrl": "https://teams.microsoft.com/l/message/19%3Ad5d2708d408c41d98424c1c354c19db3%40thread.tacv2/1616990417393?groupId=fbe2bf47-16c8-47cf-b4a5-4b9b187c508b&tenantId=2432b57b-0abd-43db-aa7b-16eadd115d34&createdTime=1616990417393&parentMessageId=1616990417393",
"policyViolation": null,
"eventDetail": null,
"from": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "8ea0e38b-efb3-4757-924a-5f94061cf8c2",
"displayName": "Robin Kline",
"userIdentityType": "aadUser"
}
},
"body": {
"contentType": "text",
"content": "Test message"
},
"channelIdentity": {
"teamId": "fbe2bf47-16c8-47cf-b4a5-4b9b187c508b",
"channelId": "19:d5d2708d408c41d98424c1c354c19db3@thread.tacv2"
},
"attachments": [],
"mentions": [],
"reactions": []
},
{
"@odata.type": "#microsoft.graph.chatMessage",
"id": "1616990171266",
"replyToId": "1616990032035",
"etag": "1616990171266",
"messageType": "message",
"createdDateTime": "2021-03-29T03:56:11.266Z",
"lastModifiedDateTime": "2021-03-29T03:56:11.266Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": null,
"importance": "normal",
"locale": "en-us",
"webUrl": "https://teams.microsoft.com/l/message/19%3A4a95f7d8db4c4e7fae857bcebe0623e6%40thread.tacv2/1616990171266?groupId=fbe2bf47-16c8-47cf-b4a5-4b9b187c508b&tenantId=2432b57b-0abd-43db-aa7b-16eadd115d34&createdTime=1616990171266&parentMessageId=1616990032035",
"policyViolation": null,
"eventDetail": null,
"from": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "8ea0e38b-efb3-4757-924a-5f94061cf8c2",
"displayName": "Robin Kline",
"userIdentityType": "aadUser"
}
},
"body": {
"contentType": "text",
"content": "Hello World"
},
"channelIdentity": {
"teamId": "fbe2bf47-16c8-47cf-b4a5-4b9b187c508b",
"channelId": "19:4a95f7d8db4c4e7fae857bcebe0623e6@thread.tacv2"
},
"attachments": [],
"mentions": [],
"reactions": []
}
]
}
Feedback
Submit and view feedback for