List Chat Messages
List messages from a chat.
- Least privileged Microsoft Graph permission to access the action via application:
ChatMessage.Read.Chat
. - Least privileged Microsoft Graph permission to access the action via OAuth:
Chat.Read
.
More information about the higher privileged permissions can be found in the Microsoft Teams permissions documentation.
External Documentation
To learn more, visit the Microsoft Teams documentation.
Parameters
Parameter | Description |
---|---|
Chat ID | The id of the chat. |
Filter | Filters results (rows). For example: (lastModifiedDateTime gt now() - "15m") (not required) |
Example Output
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#chats('19%3A2da4c29f6d7041eca70b638b43d45437%40thread.v2')/messages",
"@odata.count": 3,
"@odata.nextLink": "https://graph.microsoft.com/v1.0/chats/19:2da4c29f6d7041eca70b638b43d45437@thread.v2/messages?$top=2&$skiptoken=M2UyZDAwMDAwMDMxMzkzYTMyNjQ2MTM0NjMzMjM5NjYzNjY0MzczMDM0MzE2NTYzNjEzNzMwNjIzNjMzMzg2MjM0MzM2NDM0MzUzNDMzMzc0MDc0Njg3MjY1NjE2NDJlNzYzMjAxZThmYjY4M2Y3ODAxMDAwMDg4NjA5ODdhNzgwMTAwMDB8MTYxNjk2NDUwOTgzMg%3d%3d",
"value": [
{
"id": "1616964509832",
"replyToId": null,
"etag": "1616964509832",
"messageType": "message",
"createdDateTime": "2021-03-28T20:48:29.832Z",
"lastModifiedDateTime": "2021-03-28T20:48:29.832Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": "19:2da4c29f6d7041eca70b638b43d45437@thread.v2",
"importance": "normal",
"locale": "en-us",
"webUrl": null,
"channelIdentity": null,
"policyViolation": null,
"eventDetail": null,
"from": {
"application": null,
"device": null,
"user": {
"id": "8ea0e38b-efb3-4757-924a-5f94061cf8c2",
"displayName": "Robin Kline",
"userIdentityType": "aadUser"
}
},
"body": {
"contentType": "text",
"content": "Hello world"
},
"attachments": [],
"mentions": [],
"reactions": []
},
{
"id": "1615971548136",
"replyToId": null,
"etag": "1615971548136",
"messageType": "message",
"createdDateTime": "2021-03-17T08:59:08.136Z",
"lastModifiedDateTime": "2021-03-17T08:59:08.136Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": "19:2da4c29f6d7041eca70b638b43d45437@thread.v2",
"importance": "normal",
"locale": "en-us",
"webUrl": null,
"channelIdentity": null,
"policyViolation": null,
"eventDetail": null,
"from": {
"application": null,
"device": null,
"user": {
"id": "8ea0e38b-efb3-4757-924a-5f94061cf8c2",
"displayName": "Robin Kline",
"userIdentityType": "aadUser"
}
},
"body": {
"contentType": "html",
"content": "<div><div><div><span><img height=\"63\" src=\"https://graph.microsoft.com/v1.0/chats/19:2da4c29f6d7041eca70b638b43d45437@thread.v2/messages/1615971548136/hostedContents/aWQ9eF8wLXd1cy1kOS1lNTRmNjM1NWYxYmJkNGQ3ZTNmNGJhZmU4NTI5MTBmNix0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLXd1cy1kOS1lNTRmNjM1NWYxYmJkNGQ3ZTNmNGJhZmU4NTI5MTBmNi92aWV3cy9pbWdv/$value\" width=\"67\" style=\"vertical-align:bottom; width:67px; height:63px\"></span></div></div></div>"
},
"attachments": [],
"mentions": [],
"reactions": []
},
{
"id": "1615943825123",
"replyToId": null,
"etag": "1615943825123",
"messageType": "unknownFutureValue",
"createdDateTime": "2021-03-1706:47:05.123Z",
"lastModifiedDateTime": "2021-03-1706:47:05.123Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": "19:2da4c29f6d7041eca70b638b43d45437@thread.v2",
"importance": "normal",
"locale": "en-us",
"webUrl": null,
"channelIdentity": null,
"policyViolation": null,
"from": null,
"body": {
"contentType": "html",
"content": "<systemEventMessage/>"
},
"attachments": [],
"mentions": [],
"reactions": [],
"eventDetail": {
"@odata.type": "#microsoft.graph.chatRenamedEventMessageDetail",
"chatId": "19:2da4c29f6d7041eca70b638b43d45437@thread.v2",
"chatDisplayName": "Graph Members",
"initiator": {
"application": null,
"device": null,
"user": {
"id": "1fb8890f-423e-4154-8fbf-db6809bc8756",
"displayName": null,
"userIdentityType": "aadUser"
}
}
}
}
]
}
Workflow Library Example
List Chat Messages with Microsoft Teams and Send Results Via Email