TeamsMessagePreviewEditRouteAttribute 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.
Attribute to define a route that handles Teams message extension agent message preview edit events for a specific command.
[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewEditHandler))]
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class TeamsMessagePreviewEditRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewEditHandler))>]
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type TeamsMessagePreviewEditRouteAttribute = class
inherit Attribute
interface IRouteAttribute
Public Class TeamsMessagePreviewEditRouteAttribute
Inherits Attribute
Implements IRouteAttribute
- Inheritance
-
TeamsMessagePreviewEditRouteAttribute
- Attributes
- Implements
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.
Constructors
| Name | Description |
|---|---|
| TeamsMessagePreviewEditRouteAttribute(String, String, Boolean, UInt16, String) |
Attribute to define a route that handles Teams message extension agent message preview edit events for a specific command. |
Methods
| Name | Description |
|---|---|
| AddRoute(AgentApplication, MethodInfo) | |