M365AttachmentDownloader class
Downloads attachments from Teams and M365 using the bots access token. Enabled outbound validation requires HTTPS and validates addresses at every redirect. Initial request credentials are not forwarded to redirects when validation is enabled.
Constructors
| M365Attachment |
Creates an attachment downloader. |
Methods
| download |
Downloads files from the attachments in the current turn context and stores them in state. |
| download |
Download any files relative to the current user's input. |
Constructor Details
M365AttachmentDownloader<TState>(string, OutboundUrlPolicy)
Creates an attachment downloader.
new M365AttachmentDownloader(stateKey?: string, outboundHostValidator?: OutboundUrlPolicy)
Parameters
- stateKey
-
string
Turn-state key used by downloadAndStoreFiles.
- outboundHostValidator
- OutboundUrlPolicy
Policy used to validate attachment download URLs.
Method Details
downloadAndStoreFiles(TurnContext, TState)
Downloads files from the attachments in the current turn context and stores them in state.
function downloadAndStoreFiles(context: TurnContext, state: TState): Promise<void>
Parameters
- context
- TurnContext
The turn context containing the activity with attachments.
- state
-
TState
The turn state to store the files in.
Returns
Promise<void>
A promise that resolves when the downloaded files are stored.
downloadFiles(TurnContext)
Download any files relative to the current user's input.
function downloadFiles(context: TurnContext): Promise<InputFile[]>
Parameters
- context
- TurnContext
Context for the current turn of conversation.
Returns
Promise<InputFile[]>
Promise that resolves to an array of downloaded input files.