Language

ConversationClient.UploadAttachmentAsync Method

Definition

Uploads an attachment to the channel's blob storage.

public virtual System.Threading.Tasks.Task<Microsoft.Teams.Core.UploadAttachmentResponse> UploadAttachmentAsync(string conversationId, Microsoft.Teams.Core.AttachmentData attachmentData, Uri serviceUrl, Microsoft.Teams.Core.Http.BotRequestContext? requestContext = default, System.Collections.Generic.Dictionary<string,string>? customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadAttachmentAsync : string * Microsoft.Teams.Core.AttachmentData * Uri * Microsoft.Teams.Core.Http.BotRequestContext * System.Collections.Generic.Dictionary<string, string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Teams.Core.UploadAttachmentResponse>
override this.UploadAttachmentAsync : string * Microsoft.Teams.Core.AttachmentData * Uri * Microsoft.Teams.Core.Http.BotRequestContext * System.Collections.Generic.Dictionary<string, string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Teams.Core.UploadAttachmentResponse>
Public Overridable Function UploadAttachmentAsync (conversationId As String, attachmentData As AttachmentData, serviceUrl As Uri, Optional requestContext As BotRequestContext = Nothing, Optional customHeaders As Dictionary(Of String, String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of UploadAttachmentResponse)

Parameters

conversationId
String

The ID of the conversation. Cannot be null or whitespace.

attachmentData
AttachmentData

The attachment data to upload. Cannot be null.

serviceUrl
Uri

The service URL for the conversation. Cannot be null.

requestContext
BotRequestContext

Optional per-request properties (see BotRequestContext) to stamp onto the request's options.

customHeaders
Dictionary<String,String>

Optional custom headers to include in the request.

cancellationToken
CancellationToken

A cancellation token that can be used to cancel the operation.

Returns

A task that represents the asynchronous operation. The task result contains the response with an attachment ID.

Exceptions

Thrown if the attachment could not be uploaded successfully.

Remarks

This is useful for storing data in a compliant store when dealing with enterprises.

Applies to