Conversations.CreateConversationWithHttpMessagesAsync 方法

定义

重载

CreateConversationWithHttpMessagesAsync(ConversationParameters, Dictionary<String,List<String>>, CancellationToken)
CreateConversationWithHttpMessagesAsync(ConversationParameters, Dictionary<String,List<String>>, CancellationToken)

CreateConversation。

CreateConversationWithHttpMessagesAsync(ConversationParameters, Dictionary<String,List<String>>, CancellationToken)

public System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse<Microsoft.Bot.Connector.ConversationResourceResponse>> CreateConversationWithHttpMessagesAsync (Microsoft.Bot.Connector.ConversationParameters parameters, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateConversationWithHttpMessagesAsync : Microsoft.Bot.Connector.ConversationParameters * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse<Microsoft.Bot.Connector.ConversationResourceResponse>>
override this.CreateConversationWithHttpMessagesAsync : Microsoft.Bot.Connector.ConversationParameters * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse<Microsoft.Bot.Connector.ConversationResourceResponse>>
Public Function CreateConversationWithHttpMessagesAsync (parameters As ConversationParameters, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpOperationResponse(Of ConversationResourceResponse))

参数

customHeaders
Dictionary<String,List<String>>
cancellationToken
CancellationToken

返回

Task<Microsoft.Rest.HttpOperationResponse<ConversationResourceResponse>>

实现

适用于

CreateConversationWithHttpMessagesAsync(ConversationParameters, Dictionary<String,List<String>>, CancellationToken)

CreateConversation。

public System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse<Microsoft.Bot.Schema.ConversationResourceResponse>> CreateConversationWithHttpMessagesAsync (Microsoft.Bot.Schema.ConversationParameters parameters, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateConversationWithHttpMessagesAsync : Microsoft.Bot.Schema.ConversationParameters * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse<Microsoft.Bot.Schema.ConversationResourceResponse>>
override this.CreateConversationWithHttpMessagesAsync : Microsoft.Bot.Schema.ConversationParameters * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse<Microsoft.Bot.Schema.ConversationResourceResponse>>
Public Function CreateConversationWithHttpMessagesAsync (parameters As ConversationParameters, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpOperationResponse(Of ConversationResourceResponse))

参数

parameters
ConversationParameters

要从中创建会话的参数。

customHeaders
Dictionary<String,List<String>>

将添加到请求的标头。

cancellationToken
CancellationToken

取消标记。

返回

Task<Microsoft.Rest.HttpOperationResponse<ConversationResourceResponse>>

包含响应正文和响应标头的响应对象。

实现

例外

操作返回无效状态代码时引发。

Microsoft.Rest.SerializationException

无法反序列化响应时引发。

Microsoft.Rest.ValidationException

当输入值与预期的数据类型、范围或模式不匹配时引发。

当所需的参数为 null 时引发。

注解

创建新的对话。

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() ... ) ;

.

适用于