Skip to content

Commit

Permalink
[#5676] BotFrameworkAdapter CreateConversationAsync overrides convers…
Browse files Browse the repository at this point in the history
…ationParameters.ChannelData (#5727)

* Fix tenant setting in ChannelData

* Mark method as obsolete

Co-authored-by: CeciliaAvila <cecilia.avila@southworks.com>
  • Loading branch information
MartinLuccanera and ceciliaavila committed Jun 24, 2021
1 parent 54c7554 commit 9316bce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/Microsoft.Bot.Builder/BotFrameworkAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,7 @@ public virtual async Task CreateConversationAsync(string channelId, string servi
/// specified users, the ID of the activity's <see cref="IActivity.Conversation"/>
/// will contain the ID of the new conversation.</para>
/// </remarks>
[Obsolete("This method will soon be deprecated. Use the one without the 'reference' parameter.")]
public virtual Task CreateConversationAsync(string channelId, string serviceUrl, MicrosoftAppCredentials credentials, ConversationParameters conversationParameters, BotCallbackHandler callback, ConversationReference reference, CancellationToken cancellationToken)
{
return CreateConversationAsync(channelId, serviceUrl, (AppCredentials)credentials, conversationParameters, callback, reference, cancellationToken);
Expand Down Expand Up @@ -1350,6 +1351,7 @@ public virtual Task CreateConversationAsync(string channelId, string serviceUrl,
/// specified users, the ID of the activity's <see cref="IActivity.Conversation"/>
/// will contain the ID of the new conversation.</para>
/// </remarks>
[Obsolete("This method will soon be deprecated. Use the one without the 'reference' parameter.")]
public virtual async Task CreateConversationAsync(string channelId, string serviceUrl, AppCredentials credentials, ConversationParameters conversationParameters, BotCallbackHandler callback, ConversationReference reference, CancellationToken cancellationToken)
{
if (reference.Conversation != null)
Expand All @@ -1359,7 +1361,9 @@ public virtual async Task CreateConversationAsync(string channelId, string servi
if (tenantId != null)
{
// Putting tenantId in channelData is a temporary solution while we wait for the Teams API to be updated
conversationParameters.ChannelData = new { tenant = new { tenantId } };
var channelData = JObject.FromObject(conversationParameters.ChannelData ?? new { });
channelData["tenant"] = JToken.FromObject(new { tenantId = reference.Conversation.TenantId });
conversationParameters.ChannelData = channelData;

// Permanent solution is to put tenantId in parameters.tenantId
conversationParameters.TenantId = tenantId;
Expand Down

0 comments on commit 9316bce

Please sign in to comment.