Language

TeamsMessagePreviewEditRouteAttribute Constructor

Definition

Attribute to define a route that handles Teams message extension agent message preview edit events for a specific command.

public TeamsMessagePreviewEditRouteAttribute(string commandId = default, string commandIdPattern = default, bool isAgenticOnly = false, ushort rank = 32767, string signInHandlers = default);
new Microsoft.Agents.Extensions.MSTeams.MessageExtensions.TeamsMessagePreviewEditRouteAttribute : string * string * bool * uint16 * string -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.TeamsMessagePreviewEditRouteAttribute
Public Sub New (Optional commandId As String = Nothing, Optional commandIdPattern As String = Nothing, Optional isAgenticOnly As Boolean = false, Optional rank As UShort = 32767, Optional signInHandlers As String = Nothing)

Parameters

commandId
String

The message extension command ID to match. Mutually exclusive with commandIdPattern.

commandIdPattern
String

The regular expression pattern to match the message extension command ID. Mutually exclusive with commandId.

isAgenticOnly
Boolean

When true, the route only fires for agentic turns. Defaults to false.

rank
UInt16

Route evaluation order. Lower values run first. Defaults to Unspecified.

signInHandlers
String

A comma/space/semicolon-delimited list of OAuth sign-in handler names, or the name of an instance method on the agent class matching Func<ITurnContext, string[]>.

Remarks

Decorate a method with this attribute to register it as a handler for message extension agent message preview edit events in Teams. The method must match the MessagePreviewEditHandler delegate signature.

[TeamsMessagePreviewEditRoute("composeCmd")]
public Task<Response> OnMessagePreviewEditAsync(ITeamsTurnContext turnContext, ITurnState turnState, IActivity activityPreview, CancellationToken cancellationToken)
{
    // Re-open the compose form populated with the draft content
    var draft = activityPreview.Attachments?.FirstOrDefault()?.Content;
    return Task.FromResult(new Response { ComposeExtension = new Result { Type = ResultType.List, Attachments = [BuildEditCard(draft)] } });
}

Alternatively, OnMessagePreviewEdit(String, MessagePreviewEditHandler, String[], UInt16) can be used to register the handler via the fluent API.

Applies to