Search code examples
c#.net-corebotframeworkmicrosoft-teams

How to get continuation token to pass in GetConversationsAsync?


I am building a bot service to integrate with Microsoft Teams. I am new so I found difficulties to sort things out.

Here is the C# code and the string value was the continue token.

var convo = ((BotFrameworkAdapter)turnContext.Adapter).GetConversationsAsync(turnContext, "", cancellationToken);

Solution

  • GetConversationsAsync uses the Get Conversations API. This API must be called many times in sequence in order to retrieve all the conversations a bot has participated in. The continuation token is used to help each call continue where the last one left off. Therefore, the first call needs no continuation token. For each subsequent call, you should use the continuation token from the conversations result returned by the previous call.