private async Task <HttpResponseMessage> HandleO365ConnectorCardActionQuery(Activity activity) { var connectorClient = new ConnectorClient(new Uri(activity.ServiceUrl)); var userInfo = UserInfoRepository.GetUserInfo(activity.From.Id); // Validate for Sing In if (userInfo == null || userInfo.ExpiryTime < DateTime.Now) { var reply = activity.CreateReply(); SigninCard plCard = RootDialog.GetSignInCard(); reply.Attachments.Add(plCard.ToAttachment()); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(reply); return(new HttpResponseMessage(System.Net.HttpStatusCode.OK)); } var email = string.Empty; var member = connectorClient.Conversations.GetConversationMembersAsync(activity.Conversation.Id).Result.AsTeamsChannelAccounts().FirstOrDefault(); if (member != null) { email = member.Email; } // Get O365 connector card query data. Task <Task> task = new Task <Task>(async() => { O365ConnectorCardActionQuery o365CardQuery = activity.GetO365ConnectorCardActionQueryData(); Activity replyActivity = activity.CreateReply(); switch (o365CardQuery.ActionId) { case "Custom": // Get Passenger List & Name var teamDetails = Newtonsoft.Json.JsonConvert.DeserializeObject <CustomTeamData>(o365CardQuery.Body); await CreateTeam(connectorClient, activity, userInfo, teamDetails.TeamName, teamDetails.Members.Split(';').ToList()); break; case "Flight": var flightDetails = Newtonsoft.Json.JsonConvert.DeserializeObject <O365BodyValue>(o365CardQuery.Body); await CreateTeam(connectorClient, activity, userInfo, "Flight-" + flightDetails.Value, GetMemberList(email)); // await AttachClassWisePassengerList(classInfo.Value, replyActivity, $"Passengers with {classInfo.Value} tickets"); break; default: break; } }); task.Start(); return(new HttpResponseMessage(System.Net.HttpStatusCode.OK)); }