ConversationsExtensions.CreateConversationAsync 方法

定义

重载

CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)
CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)

CreateConversation。

CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)

public static System.Threading.Tasks.Task<Microsoft.Bot.Connector.ConversationResourceResponse> CreateConversationAsync (this Microsoft.Bot.Connector.IConversations operations, Microsoft.Bot.Connector.ConversationParameters parameters, System.Threading.CancellationToken cancellationToken = default);
static member CreateConversationAsync : Microsoft.Bot.Connector.IConversations * Microsoft.Bot.Connector.ConversationParameters * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Connector.ConversationResourceResponse>
<Extension()>
Public Function CreateConversationAsync (operations As IConversations, parameters As ConversationParameters, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ConversationResourceResponse)

参数

operations
IConversations
cancellationToken
CancellationToken

返回

适用于

CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)

CreateConversation。

public static System.Threading.Tasks.Task<Microsoft.Bot.Schema.ConversationResourceResponse> CreateConversationAsync (this Microsoft.Bot.Connector.IConversations operations, Microsoft.Bot.Schema.ConversationParameters parameters, System.Threading.CancellationToken cancellationToken = default);
static member CreateConversationAsync : Microsoft.Bot.Connector.IConversations * Microsoft.Bot.Schema.ConversationParameters * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Schema.ConversationResourceResponse>
<Extension()>
Public Function CreateConversationAsync (operations As IConversations, parameters As ConversationParameters, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ConversationResourceResponse)

参数

operations
IConversations

此扩展方法的操作组。

parameters
ConversationParameters

要从中创建会话的参数。

cancellationToken
CancellationToken

取消标记。

返回

新的对话。

注解

创建新的对话。

POST 到此方法,其中 * 机器人是创建聊天的机器人 * 如果这不是直接消息,则 IsGroup 设置为 true (默认值为 false) * 包含要包含在聊天中的成员的数组

返回值为 ResourceResponse,其中包含适合在消息有效负载和 REST API URI 中使用的会话 ID。

大多数通道仅支持启动直接消息会话的机器人的语义。 如何执行此操作的示例为:

var resource = await connector.conversations.CreateConversation(new
ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
ChannelAccount("user1") } );
await connect.Conversations.SendToConversationAsync(resource.Id, new
Activity() ... ) ;

.

适用于