How to fetch the lists the members of the current conversation using Cloud adapter in Chatbot

Brass Contributor

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 'GetConversationMembersAsync' gets the list of members of the current conversation. We need the same replacement of this method in Cloud adapter to return the channel account of the current conversation members .

GetConversationMembersAsync in BotFrameworkAdapter,

7 Replies
@Lakshmi_145- Thanks for reporting your issue.
We will investigate this issue and get back to you.

@Lakshmi_145 -You can try with the below code snippets.
Sample link-Microsoft-Teams-Samples/TeamsConversationBot.cs at 6d681dbf8133921172adf3d6aa03843ab09715ce · Office...

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

 

@Aiswarya_Lakshmy -Hope you are doing well!

Did you get chance to check above suggestion?

@Sayali-MSFT ,

 

I have tried the same method , but i didnt get the data how we got with Bot Adapter 

@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.
concerastionmemberteam.png

 

Sample link-Microsoft-Teams-Samples/TeamsConversationBot.cs at 6d681dbf8133921172adf3d6aa03843ab09715ce · Office...