Class ChatMessage

java.lang.Object
com.independentsoft.graph.teams.ChatMessage
All Implemented Interfaces:
ICreatable, IUpdatable

public class ChatMessage extends Object implements ICreatable, IUpdatable
Represents an individual chat message within a channel or chat in Microsoft Teams.

A ChatMessage can be a root message or part of a reply thread. It carries the message body, sender, attachments, and metadata such as importance and creation time.

Example usage:

 // Compose a chat message
 ChatMessage message = new ChatMessage();
 message.setBody(new ItemBody("Hello team!", ContentType.TEXT));
 
Since:
1.0
See Also:
chatMessage resource type, Chat
  • Constructor Details

    • ChatMessage

      public ChatMessage()
    • ChatMessage

      public ChatMessage(JsonObject jsonObject)
  • Method Details

    • toCreateJson

      public String toCreateJson()
      Description copied from interface: ICreatable
      Converts this object to its JSON representation for creation.

      This method generates a JSON string containing all properties needed to create a new instance of this resource in Microsoft Graph. Only properties appropriate for creation should be included (e.g., excluding read-only properties like ID, createdTime, etc.).

      Specified by:
      toCreateJson in interface ICreatable
      Returns:
      JSON string representation for creating this resource
    • toUpdateJson

      public String toUpdateJson()
      Description copied from interface: IUpdatable
      Converts this object to its JSON representation for update.

      This method generates a JSON string containing all modified properties that should be updated in Microsoft Graph. Only writeable properties with non-null values are typically included.

      Specified by:
      toUpdateJson in interface IUpdatable
      Returns:
      JSON string representation for updating this resource
    • toUpdateJson

      public String toUpdateJson(List<String> propertyNames)
      Description copied from interface: IUpdatable
      Converts this object to JSON for update with specific properties.

      This method generates a JSON string containing only the specified properties. This enables partial updates where only certain fields need to be modified, reducing payload size and avoiding unintended changes to other properties.

      Specified by:
      toUpdateJson in interface IUpdatable
      Parameters:
      propertyNames - List of property names to include in the JSON. If null or empty, all modified properties are included.
      Returns:
      JSON string representation for updating specific properties
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getId

      public String getId()
    • getReplyToId

      public String getReplyToId()
    • setReplyToId

      public void setReplyToId(String replyToId)
    • getFrom

      public ChatMessageFromIdentitySet getFrom()
    • setFrom

      public void setFrom(ChatMessageFromIdentitySet from)
    • getEtag

      public String getEtag()
    • setEtag

      public void setEtag(String etag)
    • getMessageType

      public String getMessageType()
    • setMessageType

      public void setMessageType(String messageType)
    • getCreatedTime

      public Date getCreatedTime()
    • getLastModifiedTime

      public Date getLastModifiedTime()
    • getLastEditedTime

      public Date getLastEditedTime()
    • getDeletedTime

      public Date getDeletedTime()
    • getSubject

      public String getSubject()
    • setSubject

      public void setSubject(String subject)
    • getBody

      public ItemBody getBody()
    • setBody

      public void setBody(ItemBody body)
    • getSummary

      public String getSummary()
    • setSummary

      public void setSummary(String summary)
    • getAttachments

      public List<ChatMessageAttachment> getAttachments()
    • getImportance

      public ChatMessageImportance getImportance()
    • setImportance

      public void setImportance(ChatMessageImportance importance)
    • getLocale

      public String getLocale()
    • setLocale

      public void setLocale(String locale)
    • getChatId

      public String getChatId()
    • setChatId

      public void setChatId(String chatId)
    • getChannelIdentity

      public ChannelIdentity getChannelIdentity()
    • setChannelIdentity

      public void setChannelIdentity(ChannelIdentity channelIdentity)
    • getWebUrl

      public String getWebUrl()
    • getMentions

      public List<ChatMessageMention> getMentions()
    • getReactions

      public List<ChatMessageReaction> getReactions()
    • getHostedContents

      public List<ChatMessageHostedContent> getHostedContents()
    • getPolicyViolation

      public ChatMessagePolicyViolation getPolicyViolation()
    • setPolicyViolation

      public void setPolicyViolation(ChatMessagePolicyViolation policyViolation)