ChannelMessages
Returns messages and replies exchanged within a Microsoft Teams channel.
Table Specific Information
Select
The add-in uses the Microsoft Teams API to process WHERE clause conditions built with the columns and operator shown below. The rest of the filter is executed client-side within the add-in.
- TeamId supports '=' operator.
- ChannelId supports '=' operator.
- Id supports '=' operator.
- ReplyToId supports '=' operator.
Note: ChannelId and TeamId are required columns to get results from this view, and must both be specified in the WHERE clause. The data cannot be retrieved by the add-in using ChannelId alone.
Example Queries
The add-in executes this by fetching ChannelID and TeamId from Microsoft Teams API:
SELECT * FROM ChannelMessages
This query uses the TeamID from Microsoft Teams API to obtain the ChannelID:
SELECT * FROM ChannelMessages WHERE TeamId = '4729c5e5-f923-4435-8a41-44423d42ea79'
SELECT * FROM ChannelMessages WHERE TeamId = '4729c5e5-f923-4435-8a41-44423d42ea79' AND ChannelId = '19:[email protected]'
SELECT * FROM ChannelMessages WHERE TeamId = '4729c5e5-f923-4435-8a41-44423d42ea79' AND ChannelId = '19:[email protected]' AND Id='1688061957561'
To get all the replies in a message:
SELECT * FROM ChannelMessages WHERE TeamId = '4729c5e5-f923-4435-8a41-44423d42ea79' AND ChannelId = '19:[email protected]' AND ReplyToId='1688061957561'
SELECT * FROM ChannelMessages WHERE TeamId = '4729c5e5-f923-4435-8a41-44423d42ea79' AND ChannelId = '19:[email protected]' AND Id='1688061957562' AND ReplyToId='1688061957561'
Columns
| Name | Type | Description |
| Id [KEY] | String | Unique identifier for the channel message in Microsoft Teams. |
| BodyContent | String | Plaintext or rich text content of the message body. |
| BodyContentType | String | Specifies the format of the message body content, such as text or HTML. |
| ChannelId | String | Identifier of the Microsoft Teams channel where the message was posted. |
| TeamId | String | Identifier of the team associated with the channel. |
| Mentions | String | List of entities mentioned in the message. Supported entities include user, bot, team, and channel. |
| Reactions | String | List of reactions applied to the channel message, such as like or heart. |
| Attachments | String | References to objects attached to the message, such as files, tabs, or meetings. |
| Importance | String | Priority level of the message, such as normal, high, or urgent. |
| CreatedDateTime | Datetime | Timestamp indicating when the message was created. |
| LastEditedDateTime | Datetime | Timestamp indicating when the message was last edited. |
| LastModifiedDateTime | Datetime | Timestamp indicating when the message was last updated. |
| DeletedDateTime | Datetime | Timestamp indicating when the message was deleted, or null if it has not been deleted. |
| MessageType | String | Type of message, such as standard or system notification. |
| ChatId | String | Identifier of the chat thread when the message is part of a threaded conversation. |
| Etag | String | Version identifier for the message used for concurrency control. |
| FromUserDisplayName | String | Display name of the user who sent the message. |
| FromUserId | String | Unique identifier of the user who sent the message. |
| FromUserUserIdentityType | String | Specifies the identity type of the user who sent the message. |
| FromApplication | String | Name of the application that sent the message, if applicable. |
| FromDevice | String | Name of the device used to send the message, if available. |
| Locale | String | Locale setting of the message as defined by the client application, typically en-us. |
| PolicyViolation | String | Details about any policy violations associated with the message. |
| ReplyToId | String | Identifier of the parent message when the current message is part of a reply thread. |
| Subject | String | Subject line of the message in plaintext, if provided. |
| Summary | String | Summary text of the message for use in notifications, previews, or fallback views. Applies only to channel messages. |
| WebUrl | String | Direct link to view the message in Microsoft Teams. |
| EventDetail | String | Details about the event associated with the message, if applicable. |