Language

TeamsMessagePreviewSendRouteAttribute Class

Definition

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

[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewSendHandler))]
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class TeamsMessagePreviewSendRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewSendHandler))>]
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type TeamsMessagePreviewSendRouteAttribute = class
    inherit Attribute
    interface IRouteAttribute
Public Class TeamsMessagePreviewSendRouteAttribute
Inherits Attribute
Implements IRouteAttribute
Inheritance
TeamsMessagePreviewSendRouteAttribute
Attributes
Implements

Remarks

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

[TeamsMessagePreviewSendRoute("composeCmd")]
public async Task OnMessagePreviewSendAsync(ITeamsTurnContext turnContext, ITurnState turnState, IActivity activityPreview, CancellationToken cancellationToken)
{
    // Post the confirmed message to a channel or external system
    var content = activityPreview.Attachments?.FirstOrDefault()?.Content;
    await _channel.PostAsync(content, cancellationToken);
}

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

Constructors

Name Description
TeamsMessagePreviewSendRouteAttribute(String, String, Boolean, UInt16, String)

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

Methods

Name Description
AddRoute(AgentApplication, MethodInfo)

Applies to