Language

Context<TActivity> Class

Definition

Context for a bot turn.

public class Context<TActivity> where TActivity : TeamsActivity
type Context<'Activity (requires 'Activity :> TeamsActivity)> = class
Public Class Context(Of TActivity)

Type Parameters

TActivity
Inheritance
Context<TActivity>

Constructors

Name Description
Context<TActivity>(TeamsBotApplication, TActivity)

Context for a bot turn.

Properties

Name Description
Activity

Current activity.

Api

Gets the ApiClient scoped to the current activity's service URL and the agentic identity derived from the inbound activity's recipient (the bot's own account).

AppId

Gets the application (client) ID configured for this bot.

Files

Gets the uploaded files attached to the current inbound activity, exposed as lazy IncomingFile handles. See FilesAccessor for the full contract.

HasState

Returns true if state has been loaded for this turn.

Log
Obsolete.

Gets the backward-compatible logger for this context, providing .Info(), .Error(), .Debug(), and .Warn() convenience methods that delegate to the underlying ILogger.

State

Gets the per-turn state container with ConversationState and UserState scopes.

TeamsBotApplication

Base bot application.

Methods

Name Description
GetConnectionStatusAsync(CancellationToken)

Get the token status for all configured OAuth connections. Returns every connection registered on the bot, so the developer never needs to enumerate connection names manually.

IsSignedInAsync(String, CancellationToken)
Obsolete.

Check whether the user has a valid cached token for a given OAuth connection.

Quote(String, MessageActivity, CancellationToken)
Obsolete.

Send a message to the conversation with a quoted message reference prepended to the text. Teams renders the quoted message as a preview bubble above the response text.

Quote(String, String, CancellationToken)
Obsolete.

Send a message to the conversation with a quoted message reference prepended to the text. Teams renders the quoted message as a preview bubble above the response text.

QuoteAsync(String, MessageActivityInput, CancellationToken)

Send a message to the conversation with a quoted message reference prepended to the text. Teams renders the quoted message as a preview bubble above the response text.

QuoteAsync(String, String, CancellationToken)

Send a message to the conversation with a quoted message reference prepended to the text. Teams renders the quoted message as a preview bubble above the response text.

Reply(MessageActivity, CancellationToken)
Obsolete.

Sends an activity to the conversation. When the inbound activity has an id, the response auto-quotes it (rendered as a quote bubble above the response in Teams). Otherwise sends without quoting. To send without quoting unconditionally, use SendAsync(MessageActivityInput, CancellationToken).

Reply(String, CancellationToken)
Obsolete.

Sends a text message as a threaded reply to the current activity. When the inbound activity has an id, the response auto-quotes it (rendered as a quote bubble above the response in Teams); otherwise sends without quoting.

ReplyAsync(MessageActivityInput, CancellationToken)

Sends an activity to the conversation. When the inbound activity has an id, the response auto-quotes it (rendered as a quote bubble above the response in Teams). Otherwise sends without quoting. To send without quoting unconditionally, use SendAsync(MessageActivityInput, CancellationToken).

ReplyAsync(String, CancellationToken)

Sends a text message as a threaded reply to the current activity. When the inbound activity has an id, the response auto-quotes it (rendered as a quote bubble above the response in Teams); otherwise sends without quoting.

Send(MessageActivity, CancellationToken)
Obsolete.

Sends an activity to the conversation. When the activity carries a recipient marked as targeted (a recipient with IsTargeted set), the message is sent as a targeted message visible only to that recipient.

Send(String, CancellationToken)
Obsolete.

Sends a message activity as a reply.

SendAsync(MessageActivityInput, CancellationToken)

Sends an activity to the conversation. When the activity carries a recipient marked as targeted (a recipient with IsTargeted set), the message is sent as a targeted message visible only to that recipient.

SendAsync(String, CancellationToken)

Sends a message activity as a reply.

SignIn(OAuthOptions, CancellationToken)
Obsolete.

Trigger user OAuth sign-in flow for the activity sender. Attempts silent token acquisition first; if no token is cached, sends an OAuthCard.

SignInAsync(OAuthOptions, CancellationToken)
Obsolete.

Trigger user OAuth sign-in flow for the activity sender. Attempts silent token acquisition first; if no token is cached, sends an OAuthCard.

SignOut(String, CancellationToken)
Obsolete.

Sign the user out, revoking their token from the Bot Framework Token Store.

SignOutAsync(String, CancellationToken)
Obsolete.

Sign the user out, revoking their token from the Bot Framework Token Store.

Stream()
Obsolete.

Creates a TeamsStreamingWriter bound to the given context.

Typing(CancellationToken)
Obsolete.

Sends a typing indicator to the conversation.

TypingAsync(CancellationToken)

Sends a typing indicator to the conversation.

Applies to