/// <summary> /// OnExtractHistoryFetchTaskAsync /// </summary> /// <param name="turnContext">turnContext</param> /// <param name="action">action</param> /// <param name="cancellationToken">cancellationToken</param> /// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns> public async Task <MessagingExtensionActionResponse> OnExtractHistoryFetchTaskAsync(ITurnContext <IInvokeActivity> turnContext, MessagingExtensionAction action, CancellationToken cancellationToken) { var attachment = AdaptiveTextCard(Resources.Strings.UnsupportedConversation); if (turnContext.IsSupportedConversation()) { if (action.CommandId == CommandId) { // Auth checking. Login form will be opened if auth required var isAuthenticated = await IsAuthenticated(turnContext, cancellationToken); if (!isAuthenticated) { return(await Authenticate(turnContext, action, cancellationToken)); } else if (await turnContext.IsBotAddedToTheConversationAsync()) { attachment = ExtractHistoryMessagingExtensionCard.Generate(turnContext, configuration.ReportFormats); } else { attachment = ExtractHistoryMessagingExtensionCard.GenerateInstallCard(turnContext); } } } return(new MessagingExtensionActionResponse { Task = this.TaskModuleReportCardTask(turnContext, attachment), }); }