TeamsFileConsentAcceptRouteAttribute 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 file consent accept invocations. The decorated method must match the FileConsentHandler delegate signature — the third parameter must be FileConsentValue.
[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.FileConsents.FileConsentHandler))]
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class TeamsFileConsentAcceptRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.FileConsents.FileConsentHandler))>]
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type TeamsFileConsentAcceptRouteAttribute = class
inherit Attribute
interface IRouteAttribute
Public Class TeamsFileConsentAcceptRouteAttribute
Inherits Attribute
Implements IRouteAttribute
- Inheritance
-
TeamsFileConsentAcceptRouteAttribute
- Attributes
- Implements
Remarks
Decorate a method with this attribute to register it as a handler for Teams file consent accept invocations.
[TeamsFileConsentAcceptRoute]
public async Task OnFileConsentAcceptAsync(ITeamsTurnContext turnContext, ITurnState turnState, Microsoft.Teams.Apps.Files.FileConsentValue response, CancellationToken cancellationToken)
{
using var fileStream = File.OpenRead("report.txt");
var fileContent = new StreamContent(fileStream);
fileContent.Headers.ContentLength = new FileInfo("report.txt").Length;
await httpClient.PutAsync(response.UploadInfo.UploadUrl, fileContent, cancellationToken);
}
Alternatively, OnAccept(FileConsentHandler, String[], UInt16) can be used to register the handler via the fluent API.
Constructors
| Name | Description |
|---|---|
| TeamsFileConsentAcceptRouteAttribute(Boolean, UInt16, String) |
Attribute to define a route that handles Teams file consent accept invocations. The decorated method must match the FileConsentHandler delegate signature — the third parameter must be FileConsentValue. |
Methods
| Name | Description |
|---|---|
| AddRoute(AgentApplication, MethodInfo) |
Registers a route for the specified method within the given agent application. |