ICopilotClient.SendActivityAsync(IActivity, CancellationToken) Method
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.
Sends an activity to the remote bot and returns the response as an async enumerable stream of activities.
public System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.Core.Models.IActivity> SendActivityAsync(Microsoft.Agents.Core.Models.IActivity activity, System.Threading.CancellationToken cancellationToken = default);
abstract member SendActivityAsync : Microsoft.Agents.Core.Models.IActivity * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.Core.Models.IActivity>
Public Function SendActivityAsync (activity As IActivity, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of IActivity)
Parameters
- activity
- IActivity
The activity to send.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
An async enumerable stream of activities representing the agent's responses to the sent activity.
Exceptions
Thrown when activity is null.
Thrown when the HTTP request to Copilot Studio fails.
Thrown when the response cannot be deserialized.
Remarks
This method uses the conversation ID from the activity if present, otherwise it uses the conversation ID from a previous StartConversationAsync call.