TeamsActivity Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A Teams-specific Activity that surfaces the Teams channel payload as a strongly-typed Microsoft.Teams.Api.ChannelData.
[Microsoft.Agents.Core.Serialization.ActivityType(ChannelId="msteams")]
public class TeamsActivity : Microsoft.Agents.Core.Models.Activity, Microsoft.Agents.Extensions.MSTeams.ITeamsActivity
[<Microsoft.Agents.Core.Serialization.ActivityType(ChannelId="msteams")>]
type TeamsActivity = class
inherit Activity
interface ITeamsActivity
interface IActivity
Public Class TeamsActivity
Inherits Activity
Implements ITeamsActivity
- Inheritance
- Attributes
- Implements
Remarks
The [ActivityType(ChannelId = "msteams")] annotation auto-registers this type (via the generated ActivityTypeInitAssemblyAttribute), so any inbound Activity whose ChannelId is "msteams" deserializes to TeamsActivity. The typed ChannelData shadow reads through the base ChannelData (which the deserializer populates as raw JSON), so both the base and typed views stay in sync.
Constructors
| Name | Description |
|---|---|
| TeamsActivity() | |
Properties
| Name | Description |
|---|---|
| Action |
The action field describes the meaning of the contact relation update Activity. The value of the Action field is a string. Only values of add and remove are defined, which denote a relationship between the users/Agents in the from and recipient fields. (Inherited from Activity) |
| AttachmentLayout |
The AttachmentLayout field instructs user interface renderers how to present content included in the attachments field. The value of the attachmentLayout field is of type string, with defined values of list and carousel. (Inherited from Activity) |
| Attachments |
The Attachments field contains a flat list of objects to be displayed as part of this Activity. The value of each attachments list element is a complex object of the Attachment type. (Inherited from Activity) |
| CallerId |
In some cases, it's important to record where an Activity was sent. The CallerId field is a string containing an IRI identifying the caller of an Agent. This field is not intended to be transmitted over the wire, but is instead populated by Agents and clients based on cryptographically verifiable data that asserts the identity of the callers (e.g. tokens). (Inherited from Activity) |
| ChannelData |
The Teams channel data carried on the Activity. |
| ChannelId |
The ChannelId field establishes the channel and authoritative store for the Activity. This can be a combination id for a base channel and sub-channel, such as "msteams:Copilot" or "webchat:Sharepoint". (Inherited from Activity) |
| Code |
The Code field contains a programmatic value describing why or how the conversation was ended. The value of the Code field is of type string and its meaning is defined by the channel sending the Activity. (Inherited from Activity) |
| Conversation |
The Conversation field describes the conversation in which the Activity exists. The value of the conversation field is a complex object of the Conversation account type. (Inherited from Activity) |
| DeliveryMode |
The DeliveryMode field contains any one of an enumerated set of values to signal to the recipient alternate delivery paths for the Activity or response. The value of the deliveryMode field is of type string, with defined values of 'normal', 'notification' and 'expectReplies'. The default value is normal. (Inherited from Activity) |
| Entities |
The Entities field contains a flat list of metadata objects pertaining to this Activity. Unlike attachments (see the attachments field), entities do not necessarily manifest as user-interactable content elements, and are intended to be ignored if not understood. Senders may include entities they think may be useful to a receiver even if they are not certain the receiver can accept them. The value of each entities list element is a complex object of the Entity type. (Inherited from Activity) |
| Expiration |
The Expiration field contains a time at which the Activity should be considered to be "expired" and should not be presented to the recipient. The value of the expiration field is an ISO 8601 date time format encoded datetime within a string. (Inherited from Activity) |
| From |
The From field describes which client, Agent, or channel generated an Activity. The value of the From field is a complex object of the ChannelAccount type. (Inherited from Activity) |
| Id |
The Id field establishes the identity for the Activity once it has been recorded in the channel. Activities in-flight that have not yet been recorded do not have identities. Not all activities are assigned identities (for example, a typing Activity may never be assigned an id.) (Inherited from Activity) |
| Importance |
The importance field contains an enumerated set of values to signal to the recipient the relative importance of the Activity. It is up to the receiver to map these importance hints to the user experience. The value of the importance field is of type string, with defined values of Low, Normal, High. The default value is Normal. (Inherited from Activity) |
| InputHint |
The inputHint field indicates whether or not the generator of the Activity is anticipating a response. This field is used predominantly within channels that have modal user interfaces, and is typically not used in channels with continuous chat feeds. The value of the inputHint field is of type string, with defined values of accepting, expecting, and ignoring. The default value is accepting. (Inherited from Activity) |
| Label |
The label field contains optional a label which can provide contextual information about the trace. The value of the label field is of type string. (Inherited from Activity) |
| ListenFor |
The listenFor field contains a list of terms or references to term sources that speech and language processing systems can listen for. (Inherited from Activity) |
| Locale |
The locale field communicates the language code of the text field. The value of the locale field is an IETF BCP-47 language tag within a string. (Inherited from Activity) |
| LocalTimestamp |
The localTimestamp field expresses the datetime and timezone offset where the Activity was generated. This may be different from the UTC timestamp where the Activity was recorded. The value of the localTimestamp field is an ISO 8601 encoded datetime within a string. (Inherited from Activity) |
| LocalTimezone |
The LocalTimezone field expresses the timezone where the Activity was generated. The value of the localTimezone field is a time zone name (zone entry) per the IANA Time Zone database. (Inherited from Activity) |
| MembersAdded |
The membersAdded field contains a list of channel participants (Agents or users) added to the conversation. The value of the membersAdded field is an array of type channelAccount. (Inherited from Activity) |
| MembersRemoved |
The membersRemoved field contains a list of channel participants (Agents or users) removed from the conversation. The value of the membersRemoved field is an array of type channelAccount. (Inherited from Activity) |
| Name |
The name field controls the meaning of the event and the schema of the value field. (Inherited from Activity) |
| Properties |
Gets properties that are not otherwise defined by the Activity type but that might appear in the serialized REST JSON object. (Inherited from Activity) |
| ReactionsAdded |
The reactionsAdded field contains a list of reactions added to this Activity. The value of the ReactionsAdded field is an array of type MessageReaction. (Inherited from Activity) |
| ReactionsRemoved |
The reactionsRemoved field contains a list of reactions removed from this Activity. The value of the ReactionsRemoved field is an array of type MessageReaction. (Inherited from Activity) |
| Recipient |
The recipient field describes which client or Agent is receiving this Activity. This field is only meaningful when an Activity is transmitted to exactly one recipient; it is not meaningful when it is broadcast to multiple recipients (as happens when an Activity is sent to a channel). The purpose of the field is to allow the recipient to identify themselves. This is helpful when a client or Agent has more than one identity within the channel. The value of the recipient field is a complex object of the Channel account type. (Inherited from Activity) |
| RelatesTo |
The relatesTo field references another conversation, and optionally a specific Activity within that conversation. The value of the relatesTo field is a complex object of the Conversation reference type. (Inherited from Activity) |
| ReplyToId |
The replyToId field identifies the prior Activity to which the current Activity is a reply. This field allows threaded conversation and comment nesting to be communicated between participants. replyToId is valid only within the current conversation. (See relatesTo for references to other conversations.) (Inherited from Activity) |
| RequestId | (Inherited from Activity) |
| SemanticAction |
The semanticAction field contains an optional programmatic action accompanying the user request. The semantic action field is populated by the channel and Agent based on some understanding of what the user is trying to accomplish; this understanding may be achieved with natural language processing, additional user interface elements tied specifically to these actions, through a process of conversational refinement, or contextually via other means. The meaning and structure of the semantic action is agreed ahead of time between the channel and the Agent. (Inherited from Activity) |
| ServiceUrl |
Activities are frequently sent asynchronously, with separate transport connections for sending and receiving traffic. The serviceUrl field is used by channels to denote the URL where replies to the current Activity may be sent. (Inherited from Activity) |
| Speak |
The speak field indicates how the Activity should be spoken via a text-to-speech system. The field is only used to customize speech rendering when the default is deemed inadequate. It replaces speech synthesis for any content within the Activity, including text, attachments, and summaries. The value of the speak field is either plain text or SSML encoded within a string. (Inherited from Activity) |
| SuggestedActions |
The suggestedActions field contains a payload of interactive actions that may be displayed to the user. Support for suggestedActions and their manifestation depends heavily on the channel. The value of the suggestedActions field is a complex object of the Suggested actions type. (Inherited from Activity) |
| Summary |
The summary field contains text used to replace attachments on channels that do not support them. (Inherited from Activity) |
| Text |
The text field contains text content, either in the Markdown format, XML, or as plain text. The format is controlled by the textFormat field as is plain if unspecified or ambiguous. (Inherited from Activity) |
| TextFormat |
The textFormat field denotes whether the text field should be interpreted as Markdown [3], plain text, or XML. The value of the textFormat field is of type string, with defined values of Plain, Markdown or Xml. Default is Plain. This field is not designed to be extended with arbitrary values. (Inherited from Activity) |
| TextHighlights |
The textHighlights field contains a list of text to highlight in the text field of the Activity referred to by ReplyToId. The value of the TextHighlights field is an array of type TextHighlight. (Inherited from Activity) |
| Timestamp |
The timestamp field records the exact UTC time when the Activity occurred. Due to the distributed nature of computing systems, the important time is when the channel (the authoritative store) records the Activity. The time when a client or Agent initiated an Activity may be transmitted separately in the localTimestamp field. The value of the timestamp field is an ISO 8601 date time format encoded datetime within a string. (Inherited from Activity) |
| TopicName |
The topicName field contains the text topic or description for the conversation. The value of the topicName field is of type string. (Inherited from Activity) |
| Type |
The type field controls the meaning of each Activity, and are by convention short strings (e.g. "message"). In most cases you should assign one of the well-known values from ActivityTypes (e.g. Message) rather than a raw string literal. Senders may define their own application-layer types, although they are encouraged to choose values that are unlikely to collide with future well-defined values. If senders use URIs as type values, they SHOULD NOT implement URI ladder comparisons to establish equivalence. (Inherited from Activity) |
| Value |
The value field contains a programmatic payload specific to the Activity being sent. Its meaning and format are defined in other sections of this document that describe its use. (Inherited from Activity) |
| ValueType |
The valueType field is a string type which contains a unique value which identifies the shape of the value. (Inherited from Activity) |
Methods
| Name | Description |
|---|---|
| AddAttachment(Attachment[]) |
Adds one or more attachments to Attachments and returns this activity. (Inherited from Activity) |
| AddCard(Card) |
Adds a Card as an attachment and returns this activity. (Inherited from Activity) |
| AddEntity(Entity[]) |
Adds one or more entities to Entities and returns this activity. (Inherited from Activity) |
| AddMention(ChannelAccount, String, Boolean) |
Adds a Mention entity for the given account and, optionally, prepends the mention markup to Text. (Inherited from Activity) |
| AddText(String) |
Appends the given text to Text and returns this activity. (Inherited from Activity) |
| ApplyConversationReference(ConversationReference, Boolean) |
Updates this Activity with the delivery information from an existing ConversationReference. (Inherited from Activity) |
| CreateReply(String, String) |
Creates a new message Activity as a response to this Activity. (Inherited from Activity) |
| CreateTrace(String, Object, String, String) |
Creates a new trace Activity based on this Activity. (Inherited from Activity) |
| GetAccountMention(String) |
Gets the Mention for a specific account, if this activity mentions it. (Inherited from Activity) |
| GetConversationReference() |
Creates a ConversationReference based on this Activity. (Inherited from Activity) |
| GetConversationReference(Nullable<Boolean>) |
Creates a ConversationReference based on this Activity. (Inherited from Activity) |
| GetMentions() |
Resolves the mentions from the entities of this activity. (Inherited from Activity) |
| GetReplyConversationReference(ResourceResponse) | (Inherited from Activity) |
| IsCommand() |
Returns |
| IsCommandResult() |
Returns |
| IsConversationUpdate() |
Returns |
| IsEndOfConversation() |
Returns |
| IsEvent() |
Returns |
| IsHandoff() |
Returns |
| IsInvoke() |
Returns |
| IsMessage() |
Returns |
| IsRecipientMentioned() |
Indicates whether the activity's Recipient is mentioned in the activity. (Inherited from Activity) |
| IsTargetedActivity() |
Determines whether this activity represents a targeted activity treatment. (Inherited from Activity) |
| IsTrace() |
Returns |
| IsType(String) | (Inherited from Activity) |
| IsTyping() |
Returns |
| MakeTargetedActivity(ChannelAccount) |
Marks this activity as targeted by adding a targeted treatment entity to its collection. (Inherited from Activity) |
| RemoveRecipientMention() |
Removes the recipient mention text from the Text property. (Inherited from Activity) |
| WithAttachmentLayout(String) |
Sets AttachmentLayout and returns this activity. (Inherited from Activity) |
| WithDeliveryMode(String) |
Sets DeliveryMode and returns this activity. (Inherited from Activity) |
| WithInputHint(String) |
Sets InputHint and returns this activity. (Inherited from Activity) |
| WithLocale(String) |
Sets Locale and returns this activity. (Inherited from Activity) |
| WithName(String) |
Sets Name and returns this activity. (Inherited from Activity) |
| WithSpeak(String) |
Sets Speak and returns this activity. (Inherited from Activity) |
| WithSuggestedActions(SuggestedActions) |
Sets SuggestedActions and returns this activity. (Inherited from Activity) |
| WithSummary(String) |
Sets Summary and returns this activity. (Inherited from Activity) |
| WithText(String) |
Sets Text and returns this activity. (Inherited from Activity) |
| WithTextFormat(String) |
Sets TextFormat and returns this activity. (Inherited from Activity) |
| WithValue(Object, String) |
Sets both Value and ValueType and returns this activity. (Inherited from Activity) |
| WithValue(Object) |
Sets Value and returns this activity. (Inherited from Activity) |
Extension Methods
| Name | Description |
|---|---|
| Clone(IActivity) |
Clone the activity to a new instance of activity. |
| GetActivityTreatmentEntity(IActivity) | |
| GetAgenticInstanceId(IActivity) | |
| GetAgenticTenantId(IActivity) |
Retrieves the tenant ID associated with the agentic recipient of the activity, if available; otherwise, returns the tenant ID from the conversation. |
| GetAgenticUser(IActivity) | |
| GetAIEntity(IActivity) | |
| GetChannelData<T>(IActivity) |
Gets the channel data for this activity as a strongly-typed object. |
| GetProductInfoEntity(IActivity) | |
| GetStreamingEntity(IActivity) | |
| IsAgenticRequest(IActivity) | |
| IsConnectorUser(IActivity) | |
| IsStreamingMessage(IActivity) | |
| NormalizeMentions(IActivity, Boolean) | |
| RemoveMentionText(IActivity, String) |
Remove any mention text for given id from the Activity.Text property. For example, given the message
|
| TeamsEnableFeedbackLoop(IActivity, String) |
Adds the Teams feedback loop flag to the current activity's ChannelData.
The ChannelData must be null before calling this method; returns |
| TeamsGetChannelId(IActivity) |
Gets the Team's channel id from the current activity. |
| TeamsGetMeetingInfo(IActivity) |
Gets the TeamsMeetingInfo object from the current activity. |
| TeamsGetSelectedChannelId(IActivity) |
Gets the Team's selected channel id from the current activity. |
| TeamsGetTeamInfo(IActivity) |
Gets the TeamsInfo object from the current activity. |
| TeamsGetTeamOnBehalfOf(IActivity) |
Gets the Teams OnBehalfOf list from the current activity. |
| TeamsNotifyUser(IActivity, Boolean, String) |
Configures the current activity to generate a notification within Teams. |
| TeamsNotifyUser(IActivity) |
Configures the current activity to generate a standard (non-meeting) notification within Teams. |
| ToJson(IActivity) |
Converts an IActivity to a JSON string. |
| ToTeamsActivity(IActivity) |
Converts an |
| TryGetChannelData<T>(IActivity, T) |
Gets the channel data for this activity as a strongly-typed object. A return value indicates whether the operation succeeded. |
| Validate(IActivity, ValidationContext) |
Valid Activity |