Language

AgentHostExtensions.AddAgentM365AttachmentDownloader Method

Definition

Registers the M365AttachmentDownloader for Teams/M365 channels. This downloader handles M365 attachment URLs using the configured token provider.

public static Microsoft.Extensions.Hosting.IHostApplicationBuilder AddAgentM365AttachmentDownloader(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, Microsoft.Agents.Builder.App.M365AttachmentDownloaderOptions options = default);
static member AddAgentM365AttachmentDownloader : Microsoft.Extensions.Hosting.IHostApplicationBuilder * Microsoft.Agents.Builder.App.M365AttachmentDownloaderOptions -> Microsoft.Extensions.Hosting.IHostApplicationBuilder
<Extension()>
Public Function AddAgentM365AttachmentDownloader (builder As IHostApplicationBuilder, Optional options As M365AttachmentDownloaderOptions = Nothing) As IHostApplicationBuilder

Parameters

builder
IHostApplicationBuilder

The host application builder.

options
M365AttachmentDownloaderOptions

Optional configuration for the M365 downloader.

Returns

The same builder for chaining.

Remarks

This is a convenience method equivalent to:

builder.AddAgentFileDownloader(new M365AttachmentDownloader(connections, httpClientFactory));

The IConnections and IHttpClientFactory dependencies are resolved at runtime from DI. This method should only be called once.

Applies to