Forum Discussion
Lakshmi_145
Dec 14, 2022Iron Contributor
How to fetch the lists the members of the current conversation using Cloud adapter in Chatbot
Recently we have upgraded the .net version from 3 to 6 and updated bot builder. As 'BotFrameworkAdapter' is obselete , we have used CloudAdapter instead. In BotFrameworkAdapter, method 'GetConversat...
Sayali-MSFT
Microsoft
Dec 15, 2022Lakshmi_145 -You can try with the below code snippets.
Sample link-Microsoft-Teams-Samples/TeamsConversationBot.cs at 6d681dbf8133921172adf3d6aa03843ab09715ce · OfficeDev/Microsoft-Teams-Samples (github.com)
var members = await GetPagedMembers(turnContext, cancellationToken);
foreach (var teamMember in members)
{
var proactiveMessage = MessageFactory.Text($"Hello {teamMember.GivenName} {teamMember.Surname}. I'm a Teams conversation bot.");
var conversationParameters = new ConversationParameters
{
IsGroup = false,
Bot = turnContext.Activity.Recipient,
Members = new ChannelAccount[] { teamMember },
TenantId = turnContext.Activity.Conversation.TenantId,
};
await ((CloudAdapter)turnContext.Adapter).CreateConversationAsync(
credentials.MicrosoftAppId,
teamsChannelId,
serviceUrl,
credentials.OAuthScope,
conversationParameters,
async (t1, c1) =>
{
conversationReference = t1.Activity.GetConversationReference();
await ((CloudAdapter)turnContext.Adapter).ContinueConversationAsync(
_appId,
conversationReference,
async (t2, c2) =>
{
await t2.SendActivityAsync(proactiveMessage, c2);
},
cancellationToken);
},
cancellationToken);
}
await turnContext.SendActivityAsync(MessageFactory.Text("All messages have been sent."), cancellationToken);
- Sayali-MSFTDec 16, 2022
Microsoft
@Aiswarya_Lakshmy -Hope you are doing well!
Did you get chance to check above suggestion?
- Lakshmi_145Dec 16, 2022Iron Contributor
- Sayali-MSFTDec 20, 2022
Microsoft
Lakshmi_145 -
Are you trying the above method.
We have tried with the above method; we get the members of the current conversation.
Could please set up the sample and check it once? and also share which data you did not get using this method.