Bewerken

Delen via


chatMessage resource type

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.

Represents an individual chat message within a channel or chat. The message can be a root message or part of a thread that is defined by the replyToId property in the message.

Note: This resource supports subscribing to changes (create, update, and delete) using change notifications. This allows callers to subscribe and get changes in real time. For details, see Get notifications for messages.

Methods

Method Return Type Description
Channel messages
List messages in channel chatMessage collection List of all root messages in a channel.
Create subscription for new channel messages subscription Listen for new, edited, and deleted messages, and reactions to them.
Get message in channel chatMessage Get a single root message in a channel.
Send message in channel chatMessage Create a new root message in a channel.
Update message in channel None Update the properties of a chat message.
Delete message in channel None Delete the message in a channel.
Undo the deletion of a message in channel None Undelete the message in a channel.
Set reaction to a message in channel None Set reaction to a message in a channel.
Unset reaction to a message in channel None Unset reaction to a message in a channel.
Channel message replies
List replies to message chatMessage collection List of all replies to a chat message in channel.
Get reply message in channel chatMessage Get a single reply message in a channel.
Reply to a message in channel chatMessage Reply to an existing chat message in a channel.
Update reply message chatMessage Update the properties of a chat message.
Delete reply message in channel chatMessage Delete the single reply message in a channel.
Undo deletion of a reply message in channel chatMessage Undelete the single reply message in a channel.
Set reaction to a reply message in channel chatMessage Set reaction to a reply message in a channel.
Unset reaction to a reply message in channel chatMessage Unset reaction to a reply message in a channel.
Chat messages
List messages in chat chatMessage List chat messages in a chat.
Get message in chat chatMessage Get a single chat message in a chat.
Get messages across all chats for user chat collection Get messages from all chats that a user is a participant in, including 1:1 chats, group chats, and meeting chats.
Get delta chat messages for user chatMessage collection Get the list of messages from all chats in which a user is a participant, including one-on-one chats, group chats, and meeting chats.
Get all channel messages channel collection Get all messages from all channels that a user is a participant in.
Create subscription for new chat messages subscription Listen for new, edited, and deleted chat messages, and reactions to them.
Send message in chat chatMessage Send a chat message in an existing 1:1 or group chat conversation.
Update message in chat chatMessage Update the properties of a chat message.
Delete message in chat chatMessage Delete the message of a chat.
Undo the deletion of a message in chat chatMessage Undelete the message in a chat.
Set reaction to a message in chat chatMessage Set reaction to a message in a chat.
Unset reaction to a message in chat chatMessage Unset reaction to a message in a chat.
Hosted content
List all hosted content chatMessageHostedContent collection Get all hosted contents associated with a message.
Get hosted content chatMessageHostedContent Get hosted content (and its bytes) for a message.

Properties

Property Type Description
attachments chatMessageAttachment collection References to attached objects like files, tabs, meetings etc.
body itemBody Plaintext/HTML representation of the content of the chat message. Representation is specified by the contentType inside the body. The content is always in HTML if the chat message contains a chatMessageMention.
channelIdentity channelIdentity If the message was sent in a channel, represents identity of the channel.
chatId string If the message was sent in a chat, represents the identity of the chat.
createdDateTime dateTimeOffset Timestamp of when the chat message was created.
deletedDateTime dateTimeOffset Read only. Timestamp at which the chat message was deleted, or null if not deleted.
etag string Read-only. Version number of the chat message.
eventDetail eventMessageDetail Read-only. If present, represents details of an event that happened in a chat, a channel, or a team, for example, adding new members. For event messages, the messageType property will be set to systemEventMessage.
from chatMessageFromIdentitySet Details of the sender of the chat message. Can only be set during migration.
id String Read-only. Unique ID of the message. IDs are unique within a chat/channel/reply-to-message, but might be duplicated in other chats/channels/reply-to-messages.
importance string The importance of the chat message. The possible values are: normal, high, urgent.
lastEditedDateTime dateTimeOffset Read only. Timestamp when edits to the chat message were made. Triggers an "Edited" flag in the Teams UI. If no edits are made the value is null.
lastModifiedDateTime dateTimeOffset Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
locale string Locale of the chat message set by the client. Always set to en-us.
mentions chatMessageMention collection List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
messageHistory chatMessageHistoryItem collection List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
messageType chatMessageType The type of chat message. The possible values are: message, chatEvent, typing, unknownFutureValue, systemEventMessage. Note that you must use the Prefer: include-unknown-enum-members request header to get the following value in this evolvable enum: systemEventMessage.
onBehalfOf chatMessageFromIdentitySet User attribution of the message when bot sends a message on behalf of a user.
policyViolation chatMessagePolicyViolation Defines the properties of a policy violation set by a data loss prevention (DLP) application.
reactions chatMessageReaction collection Reactions for this chat message (for example, Like).
replyToId string Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
subject string The subject of the chat message, in plaintext.
summary string Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
webUrl string Read-only. Link to the message in Microsoft Teams.

Relationships

Relationship Type Description
replies chatMessage collection Replies for a specified message. Supports $expand for channel messages.
hostedContents chatMessageHostedContent collection Content in a message hosted by Microsoft Teams - for example, images or code snippets.

JSON representation

The following JSON representation shows the resource type.

{
  "attachments": [{"@odata.type": "microsoft.graph.chatMessageAttachment"}],
  "body": {"@odata.type": "microsoft.graph.itemBody"},
  "channelIdentity": {"@odata.type": "microsoft.graph.channelIdentity"},
  "chatId": "String",
  "createdDateTime": "String (timestamp)",
  "deletedDateTime": "String (timestamp)",
  "etag": "String",
  "eventDetail": {"@odata.type": "microsoft.graph.eventMessageDetail"},
  "from": {"@odata.type": "microsoft.graph.chatMessageFromIdentitySet"},
  "id": "String (identifier)",
  "importance": "String",
  "lastEditedDateTime": "String (timestamp)",
  "lastModifiedDateTime": "String (timestamp)",
  "locale": "String",
  "mentions": [{"@odata.type": "microsoft.graph.chatMessageMention"}],
  "messageHistory": [{"@odata.type": "microsoft.graph.chatMessageHistoryItem"}],
  "messageType": "String",
  "onBehalfOf": {"@odata.type": "microsoft.graph.chatMessageFromIdentitySet"},
  "policyViolation": {"@odata.type": "microsoft.graph.chatMessagePolicyViolation"},
  "reactions": [{"@odata.type": "microsoft.graph.chatMessageReaction"}],
  "replyToId": "String (identifier)",
  "subject": "String",
  "summary": "String",
  "webUrl": "String"
}