public static Attachment GetO365ConnectorCardV2() { var section = new O365ConnectorCardSection { Title = Strings.O365V2Title, ActivityTitle = Strings.O365V2ActivityTitle, Facts = new List <O365ConnectorCardFact> { new O365ConnectorCardFact(Strings.O365V2Fact1Key, Strings.O365V2Fact1Value), new O365ConnectorCardFact(Strings.O365V2Fact2Key, Strings.O365V2Fact2Value), new O365ConnectorCardFact(Strings.O365V2Fact3Key, Strings.O365V2Fact3Value), new O365ConnectorCardFact(Strings.O365V2Fact4Key, Strings.O365V2Fact4Value) } }; var o365connector = new O365ConnectorCard { ThemeColor = Strings.O365V2themecolor, Sections = new List <O365ConnectorCardSection> { section }, }; return(o365connector.ToAttachment()); }
/// <summary> /// connector card with title, actvity title, activity subtitle, activity image, facts in section sample /// </summary> /// <returns></returns> public static Attachment O365ConnectorCardImageInSection() { var section = new O365ConnectorCardSection { ActivityTitle = Strings.O365V3ActivityTitle, ActivitySubtitle = Strings.O365V3ActivitySubtitle, ActivityImage = Strings.O365V3ImageUrl, Facts = new List <O365ConnectorCardFact> { new O365ConnectorCardFact(Strings.O365V3Fact1Key, Strings.O365V3Fact1Value), new O365ConnectorCardFact(Strings.O365V3Fact2Key, Strings.O365V3Fact2Value), } }; var o365connector = new O365ConnectorCard { ThemeColor = Strings.O365V3ThemeColor, Summary = Strings.O365V3Summary, Title = Strings.O365V3Title, Sections = new List <O365ConnectorCardSection> { section }, Text = Strings.O365V3Text }; return(o365connector.ToAttachment()); }
public static Attachment GetCardsInformation(IEnumerable <Industry> industriesList) { var list = new List <O365ConnectorCardMultichoiceInputChoice>(); foreach (var industry in industriesList) { list.Add(new O365ConnectorCardMultichoiceInputChoice(industry.IndustryName, industry.IndsutryCode)); } var section = new O365ConnectorCardSection { ActivityTitle = "A peek into inventory across locations across products.", }; var IndustryInfo = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Show Inventory", "Multiple Choice Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "Industry", true, "Industry Ex: Airline, Retail", null, list, "compact", false), }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Industry", Constants.Industry, @"{""Value"":""{{Industry.value}}""}") }); O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Title = "Inventory Information", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { IndustryInfo } }; return(card.ToAttachment()); }
public void CardTests_O365ConnectorCardExtensions() { var card = new O365ConnectorCard(); var attachment = card.ToAttachment(); Assert.AreEqual(attachment.Content, card); Assert.AreEqual(attachment.ContentType, O365ConnectorCard.ContentType); }
public static Attachment GetCardsInformation() { var section = new O365ConnectorCardSection { ActivityTitle = "Your one stop destination to managing your fleet", }; var AirCraftInfo = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Show me aircraft details", "Multiple Choice Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "flightNumberInput", true, "Enter flight number Ex: 320,777,220", null, false, null), new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "baselocationInput", true, "Enter Base Location Ex: Seattle", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show me aircraft details", Constants.ShowAirCraftDetails, @"{""FlightNumber"":""{{flightNumberInput.value}}"", ""BaseLocation"":""{{baselocationInput.value}}""}") }); O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Title = "Fleet Management", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { AirCraftInfo } }; return(card.ToAttachment()); }
public async Task <Activity> SaveIdeaAsyncAsync(Activity activity, string body) { var model = JsonConvert.DeserializeObject <CreateIdeaModel>(body); model.StartDate = new DateTime(model.StartDate.AddHours(12).Date.Ticks); var teamAccount = await activity.GetTeamsAccountAsync(); var userObjectId = teamAccount.ObjectId; var graphServiceClient = await AuthenticationHelper.GetGraphServiceClientSafeAsync(userObjectId, Permissions.Delegated); var planService = new PlannerService(graphServiceClient); var ideaService = new IdeaService(graphServiceClient); var plan = await planService.GetTeamPlanAsync(model.Team); if (plan == null) { throw new ApplicationException($"Could not found plan named '{model.Team.DisplayName}'"); } var description = $"Next Steps\r\n{model.NextSteps}\r\n\r\nAligned to Metric\r\n{model.Metric.Name}"; var startDate = new DateTimeOffset(model.StartDate, TimeSpan.FromHours(12)); var plannerTask = await ideaService.CreateAsync(plan.Id, model.Title, model.StartDate, model.Owner.Id, description); var plannerTaskUrl = ideaService.GetIdeaUrl(model.Team.Id, plan.Id, plannerTask.Id); Activity replyActivity = activity.CreateReply(); try { var clientContext = await AuthenticationHelper.GetAppOnlySharePointClientContextAsync(); var metricsService = new MetricsService(clientContext); await metricsService.CreateMetricIdeaAsync(model.Metric.Id, plannerTask, Constants.IdeasPlan.Buckets.NewIdea, plannerTaskUrl); } catch (Exception ex) { replyActivity.Text = "Failed to add item to MetricIdea list: " + ex.Message; } var card = new O365ConnectorCard("Idea created", sections: new O365ConnectorCardSection[] { new O365ConnectorCardSection( facts: new O365ConnectorCardFact[] { new O365ConnectorCardFact("Title", model.Title), new O365ConnectorCardFact("Next Steps", model.NextSteps.Replace("\n", "<br />")), new O365ConnectorCardFact("Aligned to Metric", model.Metric.Name), new O365ConnectorCardFact("Owner", model.Owner.DisplayName), new O365ConnectorCardFact("Start Date", model.StartDate.AddHours(12).ToShortDateString()), }) }); replyActivity.Attachments.Add(card.ToAttachment()); return(replyActivity); }
public static Attachment GetO365ConnectorCardV1Attachment() { var o365connector = new O365ConnectorCard { Title = Strings.O365V1Title, Sections = new List <O365ConnectorCardSection> { new O365ConnectorCardSection { Text = Strings.O365V1Section1 }, new O365ConnectorCardSection { Text = Strings.O365V1Section2 } }, }; return(o365connector.ToAttachment()); }
// Send a message with a list of found tasks. private async Task SendScheduleInterviewMessage(IDialogContext context, InterviewRequest request) { IMessageActivity reply = context.MakeMessage(); reply.Attachments = new List <Attachment>(); reply.Text = $"Here's your request to schedule an interview:"; O365ConnectorCard card = CardHelper.CreateCardForInterviewRequest(request); reply.Attachments.Add(card.ToAttachment()); ConnectorClient client = new ConnectorClient(new Uri(context.Activity.ServiceUrl)); ResourceResponse resp = await client.Conversations.ReplyToActivityAsync((Activity)reply); // Cache the response activity ID and previous interview card so that we can refresh it later. //string activityId = resp.Id.ToString(); //context.ConversationData.SetValue(request.ReqId, new Tuple<string, O365ConnectorCard>(activityId, card)); }
private static async Task SendScheduleInterviewMessage(IDialogContext context, string name, string reqId) { OfficeDev.Talent.Management.InterviewRequest request = new OfficeDev.Talent.Management.InterviewRequest { Candidate = new OfficeDev.Talent.Management.CandidatesDataController().GetCandidateByName(name), Date = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day), PositionTitle = new OfficeDev.Talent.Management.OpenPositionsDataController().GetPositionForReqId(reqId).Title, Remote = false, ReqId = reqId }; IMessageActivity reply = context.MakeMessage(); reply.Attachments = new List <Attachment>(); reply.Text = $"Here's your request to schedule an interview:"; O365ConnectorCard card = CardHelper.CreateCardForInterviewRequest(request); reply.Attachments.Add(card.ToAttachment()); ConnectorClient client = new ConnectorClient(new Uri(context.Activity.ServiceUrl)); ResourceResponse resp = await client.Conversations.ReplyToActivityAsync((Activity)reply); }
public static Attachment GetCardsInformation(IEnumerable <Cities> citieslist) { var list = new List <O365ConnectorCardMultichoiceInputChoice>(); foreach (var city in citieslist) { list.Add(new O365ConnectorCardMultichoiceInputChoice(city.CityName, city.CityCode)); } var section = new O365ConnectorCardSection { ActivityTitle = "Your one stop for all flight details", }; var FlightInfo = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Show Flights", "Multiple Choice Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "From", true, "From Ex: Seattle", null, list, "compact", false), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "To", true, "To Ex: Newark", null, list, "compact", false), new O365ConnectorCardDateInput( O365ConnectorCardDateInput.Type, "journeyDate", true, "Journey Date Ex: 30 Dec 2018", null, false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show flights", Constants.ShowFlights, @"{""From"":""{{From.value}}"", ""To"":""{{To.value}}"" , ""JourneyDate"":""{{journeyDate.value}}"" }") }); O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Title = "Flight Information", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { FlightInfo } }; return(card.ToAttachment()); }
/// <summary> /// Handles text message input sent by user. /// </summary> /// <param name="activity">Incoming request from Bot Framework.</param> /// <param name="connectorClient">Connector client instance for posting to Bot Framework.</param> /// <returns>Task tracking operation.</returns> private static async Task HandleTextMessages(Activity activity, ConnectorClient connectorClient) { if (activity.Text.Contains("GetChannels")) { Activity replyActivity = activity.CreateReply(); replyActivity.AddMentionToText(activity.From, MentionTextLocation.PrependText); ConversationList channels = connectorClient.GetTeamsConnectorClient().Teams.FetchChannelList(activity.GetChannelData <TeamsChannelData>().Team.Id); // Adding to existing text to ensure @Mention text is not replaced. replyActivity.Text = replyActivity.Text + " <p>" + string.Join("</p><p>", channels.Conversations.ToList().Select(info => info.Name + " --> " + info.Id)); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("GetTenantId")) { Activity replyActivity = activity.CreateReply(); replyActivity = replyActivity.AddMentionToText(activity.From, MentionTextLocation.PrependText); if (!activity.Conversation.IsGroup.GetValueOrDefault()) { replyActivity = replyActivity.NotifyUser(); } replyActivity.Text += " Tenant ID - " + activity.GetTenantId(); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("Create1on1")) { var response = connectorClient.Conversations.CreateOrGetDirectConversation(activity.Recipient, activity.From, activity.GetTenantId()); Activity newActivity = new Activity() { Text = "Hello", Type = ActivityTypes.Message, Conversation = new ConversationAccount { Id = response.Id }, }; await connectorClient.Conversations.SendToConversationAsync(newActivity, response.Id); } else if (activity.Text.Contains("GetMembers")) { var response = (await connectorClient.Conversations.GetConversationMembersAsync(activity.Conversation.Id)).AsTeamsChannelAccounts(); StringBuilder stringBuilder = new StringBuilder(); Activity replyActivity = activity.CreateReply(); replyActivity.Text = string.Join("</p><p>", response.ToList().Select(info => info.GivenName + " " + info.Surname + " --> " + info.ObjectId)); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("TestRetry")) { for (int i = 0; i < 15; i++) { Activity replyActivity = activity.CreateReply(); replyActivity.Text = "Message Count " + i; await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } } else if (activity.Text.Contains("O365Card")) { O365ConnectorCard card = CreateSampleO365ConnectorCard(); Activity replyActivity = activity.CreateReply(); replyActivity.Attachments = new List <Attachment>(); Attachment plAttachment = card.ToAttachment(); replyActivity.Attachments.Add(plAttachment); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else { var accountList = connectorClient.Conversations.GetConversationMembers(activity.Conversation.Id); Activity replyActivity = activity.CreateReply(); replyActivity.Text = "Help " + "<p>Type GetChannels to get List of Channels. </p>" + "<p>Type GetTenantId to get Tenant Id </p>" + "<p>Type Create1on1 to create one on one conversation. </p>" + "<p>Type GetMembers to get list of members in a conversation (team or direct conversation). </p>" + "<p>Type TestRetry to get multiple messages from Bot in throttled and retried mechanism. </p>" + "<p>Type O365Card to get a O365 actionable connector card. </p>"; replyActivity = replyActivity.AddMentionToText(activity.From); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } }
/// <summary> /// Create a sample O365 connector card. /// </summary> /// <returns>The result card with actions.</returns> /// public static Attachment CreateSampleO365ConnectorCard(string baseUri) { string imageUrl = baseUri + "/public/assets/ActionableCardIconImage.png"; #region Multichoice Card var multichoiceCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Multiple Choice", "Multiple Choice Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "CardsType", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"), new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"), new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card") }, "expanded", true), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "Teams", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Bot", "Bot"), new O365ConnectorCardMultichoiceInputChoice("Tab", "Tab"), new O365ConnectorCardMultichoiceInputChoice("Connector", "Connector"), new O365ConnectorCardMultichoiceInputChoice("Compose Extension", "Compose Extension") }, "compact", true) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST ( O365ConnectorCardHttpPOST.Type, "Send", "multichoice", @"{""CardsType"":""{{CardsType.value}}"", ""Teams"":""{{Teams.value}}""}") }); #endregion #region Input Card var inputCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Text Input", "Input Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "text-1", false, "multiline, no maxLength", null, true, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Send", "inputText", @"{""text1"":""{{text-1.value}}""}") }); #endregion #region Date Card var dateCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Date Input", "Date Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardDateInput( O365ConnectorCardDateInput.Type, "date-2", false, "date only", null, false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Send", "dateInput", @"{""date1"":""{{date-1.value}}""") }); #endregion var section = new O365ConnectorCardSection { Title = "", Text = "", ActivityTitle = "Actionable Message", ActivitySubtitle = "", ActivityText = "This is an actionable message card. You can add operations within the card.", ActivityImage = imageUrl, ActivityImageType = null, Markdown = true, Facts = null, Images = null }; O365ConnectorCard card = new O365ConnectorCard() { Summary = "O365 card summary", ThemeColor = "#E67A9E", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { multichoiceCard, inputCard, dateCard } }; return(card.ToAttachment()); }
/// <summary> /// this is the default example's content /// multiple choice (compact & expanded), text input, date and placing images in card /// </summary> /// <returns>The result card with actions.</returns> /// public static Attachment O365ActionableCardDefault() { #region multi choice examples var multichoice = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type) { Name = "Multiple Choice", Id = "Multiple Choice Card", Inputs = new List <O365ConnectorCardInputBase> { // multiple choice control with required, multiselect, expanded style new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type) { Id = "CardsType", IsRequired = true, Title = "Pick multiple options", Value = null, Choices = new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"), new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"), new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card") }, Style = "expanded", IsMultiSelect = true }, // multiple choice control with required, multiselect, compact style new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type) { Id = "Teams", IsRequired = true, Title = "Pick multiple options", Value = null, Choices = new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Bot", "Bot"), new O365ConnectorCardMultichoiceInputChoice("Tab", "Tab"), new O365ConnectorCardMultichoiceInputChoice("Connector", "Connector"), new O365ConnectorCardMultichoiceInputChoice("Compose Extension", "Compose Extension") }, Style = "compact", IsMultiSelect = true }, // multiple choice control with single item select, expanded style new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type) { Id = "Apps", IsRequired = false, Title = "Pick an App", Value = null, Choices = new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("VSTS", "VSTS"), new O365ConnectorCardMultichoiceInputChoice("Wiki", "Wiki"), new O365ConnectorCardMultichoiceInputChoice("Github", "Github") }, Style = "expanded", IsMultiSelect = false }, // multiple choice control with single item select, compact style new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type) { Id = "OfficeProduct", IsRequired = false, Title = "Pick an Office Product", Value = null, Choices = new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Outlook", "Outlook"), new O365ConnectorCardMultichoiceInputChoice("MS Teams", "MS Teams"), new O365ConnectorCardMultichoiceInputChoice("Skype", "Skype") }, Style = "compact", IsMultiSelect = false } }, Actions = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type) { Name = "Send", Id = "multichoice", Body = @"{""CardsType"":""{{CardsType.value}}"", ""Teams"":""{{Teams.value}}"", ""Apps"":""{{Apps.value}}"", ""OfficeProduct"":""{{OfficeProduct.value}}""}" } } }; #endregion #region text input examples var inputCard = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type) { Name = "Text Input", Id = "Input Card", Inputs = new List <O365ConnectorCardInputBase> { // text input control with multiline new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type) { Id = "text-1", IsRequired = false, Title = "multiline, no maxLength", Value = null, IsMultiline = true, MaxLength = null }, // text input control without multiline new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type) { Id = "text-2", IsRequired = false, Title = "single line, no maxLength", Value = null, IsMultiline = false, MaxLength = null }, // text input control with multiline, reuired, // and control the length of input box new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type) { Id = "text-3", IsRequired = true, Title = "multiline, max len = 10, isRequired", Value = null, IsMultiline = true, MaxLength = 10 }, // text input control without multiline, reuired, // and control the length of input box new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type) { Id = "text-4", IsRequired = true, Title = "single line, max len = 10, isRequired", Value = null, IsMultiline = false, MaxLength = 10 } }, Actions = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type) { Name = "Send", Id = "inputText", Body = @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}" } } }; #endregion #region date/time input examples var dateCard = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type) { Name = "Date Input", Id = "Date Card", Inputs = new List <O365ConnectorCardInputBase> { // date input control, with date and time, required new O365ConnectorCardDateInput(O365ConnectorCardDateInput.Type) { Id = "date-1", IsRequired = true, Title = "date with time", Value = null, IncludeTime = true }, // date input control, only date, no time, not required new O365ConnectorCardDateInput(O365ConnectorCardDateInput.Type) { Id = "date-2", IsRequired = false, Title = "date only", Value = null, IncludeTime = false } }, Actions = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type) { Name = "Send", Id = "dateInput", Body = @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}" } } }; #endregion var section = new O365ConnectorCardSection { Title = "**section title**", Text = "section text", ActivityTitle = "activity title", ActivitySubtitle = "activity subtitle", ActivityText = "activity text", ActivityImage = "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg", ActivityImageType = null, Markdown = true, Facts = new List <O365ConnectorCardFact> { new O365ConnectorCardFact { Name = "Fact name 1", Value = "Fact value 1" }, new O365ConnectorCardFact { Name = "Fact name 2", Value = "Fact value 2" }, }, Images = new List <O365ConnectorCardImage> { new O365ConnectorCardImage { Image = "http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg", Title = "image 1" }, new O365ConnectorCardImage { Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg", Title = "image 2" }, new O365ConnectorCardImage { Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg", Title = "image 3" } } }; O365ConnectorCard card = new O365ConnectorCard() { Summary = "O365 card summary", ThemeColor = "#E67A9E", Title = "card title", Text = "card text", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { multichoice, inputCard, dateCard, new O365ConnectorCardViewAction(O365ConnectorCardViewAction.Type) { Name = "View Action", Id = null, Target = new List <string> { "http://microsoft.com" } }, new O365ConnectorCardOpenUri(O365ConnectorCardOpenUri.Type) { Name = "Open Uri", Id = "open-uri", Targets = new List <O365ConnectorCardOpenUriTarget> { new O365ConnectorCardOpenUriTarget { Os = "default", Uri = "http://microsoft.com" }, new O365ConnectorCardOpenUriTarget { Os = "iOS", Uri = "http://microsoft.com" }, new O365ConnectorCardOpenUriTarget { Os = "android", Uri = "http://microsoft.com" }, new O365ConnectorCardOpenUriTarget { Os = "windows", Uri = "http://microsoft.com" } } } } }; return(card.ToAttachment()); }
/// <summary> /// Actionable cards can have multiple sections, each with its own set of actions. /// If a section contains only 1 card action, that is automatically expanded /// </summary> /// <returns>The result card with actions.</returns> /// public static Attachment O365ActionableCardMultipleSection() { #region Section1 #region Multichoice Card // multiple choice control with required, multiselect, compact style var multichoiceCardSection1 = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type) { Name = "Multiple Choice", Id = "Multiple Choice Card", Inputs = new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type) { Id = "cardstype", IsRequired = true, Title = "Pick multiple options", Value = null, Choices = new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"), new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"), new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card") }, Style = "compact", IsMultiSelect = true }, }, Actions = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type) { Name = "send", Id = "multichoice", Body = @"{""cardstype"":""{{cardstype.value}}""" } } }; #endregion var potentialActionSection1 = new List <O365ConnectorCardActionBase> { multichoiceCardSection1 }; var section1 = new O365ConnectorCardSection { Title = "Section Title 1", Text = "", ActivityTitle = "", ActivitySubtitle = "", ActivityText = "", ActivityImage = null, ActivityImageType = null, Markdown = true, Facts = null, Images = null, PotentialAction = potentialActionSection1 }; #endregion #region Section2 #region Input Card // text input examples var inputCard = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type) { Id = "Text Input", Name = "Input Card", // text input control with multiline Inputs = new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type) { Id = "text-1", IsRequired = false, Title = "This is the title of text box", Value = null, IsMultiline = true, MaxLength = null } }, Actions = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type) { Name = "Send", Id = "inputText", Body = @"{""text1"":""{{text-1.value}}""}" } } }; #endregion #region Multichoice Card For Section2 // multiple choice control with not required, multiselect, compact style var multichoiceCardSection2 = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type) { Name = "Multiple Choice", Id = "Multiple Choice Card", Inputs = new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type) { Id = "CardsTypesection1", //please make sure that id of the control must be unique across card to work properly IsRequired = false, Title = "This is a title of combo box", Value = null, Choices = new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"), new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"), new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card") }, Style = "compact", IsMultiSelect = true } }, Actions = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type) { Name = "Send", Id = "multichoice", Body = @"{""CardsTypesection1"":""{{CardsTypesection1.value}}""" } } }; #endregion // please always attach new potential action to individual sections var potentialActionSection2 = new List <O365ConnectorCardActionBase> { inputCard, multichoiceCardSection2 }; var section2 = new O365ConnectorCardSection { Title = "Section Title 2", Text = "", ActivityTitle = "", ActivitySubtitle = "", ActivityText = "", ActivityImage = null, ActivityImageType = null, Markdown = true, Facts = null, Images = null, PotentialAction = potentialActionSection2 }; #endregion O365ConnectorCard card = new O365ConnectorCard() { Title = "This is Actionable Card Title", Summary = "O365 card summary", ThemeColor = "#E67A9E", Sections = new List <O365ConnectorCardSection> { section1, section2 }, }; return(card.ToAttachment()); }
public static Attachment GetWelcomeMessage(string actionId, IList <ChannelAccount> members) { var section = new O365ConnectorCardSection("Please select the type of notification you want to receive", null, null, null, null); var notificationCardAction = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Select Notification", "notificationType", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "notificationType", true, "Select Notification", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Weather", "Weather"), new O365ConnectorCardMultichoiceInputChoice("Operations Delay", "OperationsDelay"), new O365ConnectorCardMultichoiceInputChoice("Social Events", "SocialEvents") }, "compact" , false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show notification", "notificationType", @"{""Value"":""{{notificationType.value}}"", ""ActionId"":""" + actionId + @""" " + (members == null?"":@",""Members"":""{{members.value}}""") + "}") }); if (members != null) { var memberSelection = new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "members", false, "Select Members", null, new List <O365ConnectorCardMultichoiceInputChoice>() , "compact" , true); memberSelection.Choices.Add(new O365ConnectorCardMultichoiceInputChoice("ALL TEAM", "ALL TEAM")); foreach (var member in members) { var nameParts = member.Name.Split(' '); var fullName = string.Empty; for (int i = 0; i < nameParts.Length && i < 2; i++) { if (!string.IsNullOrEmpty(fullName)) { fullName += " "; } fullName += nameParts[i].Trim(); } memberSelection.Choices.Add(new O365ConnectorCardMultichoiceInputChoice(fullName, member.Id)); } notificationCardAction.Inputs.Add(memberSelection); } O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Title = "Welcome to Notification Bot", Summary = "", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { notificationCardAction } }; return(card.ToAttachment()); }
public Attachment GetFilter() { var section = new O365ConnectorCardSection("Your Passport to Airline Services from within Microsoft Teams", "Use PassengerInfoBot to do the following:\n<ul>\n<li>List <strong>passengers & their profiles</strong> for this flight</li>\n<li>List <strong>frequest flyers</strong> to serve them best</li>\n<li>Locate passengers with <strong>special assistance</strong> needs</li>\n<li>Get all <strong>passengers seated in a specific zone</strong></li>\n<li>Find out <strong>who is seated</strong> at a specific location</li>\n</ul>\n\n\n\n", null, null, null, null); var classWiseCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Class", "classWiseCard", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "class", true, "Select class", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Business", "Business"), new O365ConnectorCardMultichoiceInputChoice("Economy", "Economy") }, "compact" , false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show", Constants.ClassWise, @"{""Value"":""{{class.value}}""}") }); var zoneWiseCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Passengers by Zone", "zoneWiseCard", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "zone", true, "Select Zone", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("A", "A"), new O365ConnectorCardMultichoiceInputChoice("B", "B"), new O365ConnectorCardMultichoiceInputChoice("C", "C") }, "compact" , false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show", Constants.Zone, @"{""Value"":""{{zone.value}}""}") }); var seatNumberCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Passenger by Seat #", "seatNumber", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "seatNumberInput", true, "Enter Seat Number", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show", Constants.SeatNumber, @"{""Value"":""{{seatNumberInput.value}}""}") }); O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Title = "Welcome to PassengerInfoBot", Summary = "", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "See All Passengers", Constants.All), new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "See Frequent Flyers", Constants.FrequentFlyer), new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Passengers with Special Assistance", Constants.SpecialAssistance), zoneWiseCard, seatNumberCard, classWiseCard, } }; return(card.ToAttachment()); }
/// <summary> /// Create a sample O365 connector card. /// </summary> /// <returns>The result card with actions.</returns> /// public static Attachment CreateSampleO365ConnectorCard() { #region Multichoice Card var multichoiceCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Multiple Choice", "Multiple Choice Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "CardsType", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"), new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"), new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card") }, "expanded", true), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "Teams", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Bot", "Bot"), new O365ConnectorCardMultichoiceInputChoice("Tab", "Tab"), new O365ConnectorCardMultichoiceInputChoice("Connector", "Connector"), new O365ConnectorCardMultichoiceInputChoice("Compose Extension", "Compose Extension") }, "compact", true), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "Apps", false, "Pick an App", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("VSTS", "VSTS"), new O365ConnectorCardMultichoiceInputChoice("Wiki", "Wiki"), new O365ConnectorCardMultichoiceInputChoice("Github", "Github") }, "expanded", false), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "OfficeProduct", false, "Pick an Office Product", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Outlook", "Outlook"), new O365ConnectorCardMultichoiceInputChoice("MS Teams", "MS Teams"), new O365ConnectorCardMultichoiceInputChoice("Skype", "Skype") }, "compact", false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Send", "multichoice", @"{""CardsType"":""{{CardsType.value}}"", ""Teams"":""{{Teams.value}}"", ""Apps"":""{{Apps.value}}"", ""OfficeProduct"":""{{OfficeProduct.value}}""}") }); #endregion #region Input Card var inputCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Text Input", "Input Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "text-1", false, "multiline, no maxLength", null, true, null), new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "text-2", false, "single line, no maxLength", null, false, null), new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "text-3", true, "multiline, max len = 10, isRequired", null, true, 10), new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "text-4", true, "single line, max len = 10, isRequired", null, false, 10) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Send", "inputText", @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}") }); #endregion #region Date Card var dateCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Date Input", "Date Card", new List <O365ConnectorCardInputBase> { new O365ConnectorCardDateInput( O365ConnectorCardDateInput.Type, "date-1", true, "date with time", null, true), new O365ConnectorCardDateInput( O365ConnectorCardDateInput.Type, "date-2", false, "date only", null, false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Send", "dateInput", @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}") }); #endregion var section = new O365ConnectorCardSection( "**section title**", "section text", "activity title", "activity subtitle", "activity text", "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg", true, new List <O365ConnectorCardFact> { new O365ConnectorCardFact("Fact name 1", "Fact value 1"), new O365ConnectorCardFact("Fact name 2", "Fact value 2"), }, new List <O365ConnectorCardImage> { new O365ConnectorCardImage { Image = "http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg", Title = "image 1" }, new O365ConnectorCardImage { Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg", Title = "image 2" }, new O365ConnectorCardImage { Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg", Title = "image 3" } }); O365ConnectorCard card = new O365ConnectorCard() { Summary = "O365 card summary", ThemeColor = "#E67A9E", Title = "card title", Text = "card text", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { multichoiceCard, inputCard, dateCard, new O365ConnectorCardViewAction( O365ConnectorCardViewAction.Type, "View Action", null, new List <string> { "http://microsoft.com" }), new O365ConnectorCardOpenUri( O365ConnectorCardOpenUri.Type, "Open Uri", "open-uri", new List <O365ConnectorCardOpenUriTarget> { new O365ConnectorCardOpenUriTarget { Os = "default", Uri = "http://microsoft.com" }, new O365ConnectorCardOpenUriTarget { Os = "iOS", Uri = "http://microsoft.com" }, new O365ConnectorCardOpenUriTarget { Os = "android", Uri = "http://microsoft.com" }, new O365ConnectorCardOpenUriTarget { Os = "windows", Uri = "http://microsoft.com" } }) } }; return(card.ToAttachment()); }
/// <summary> /// Handles text message input sent by user. /// </summary> /// <param name="activity">Incoming request from Bot Framework.</param> /// <param name="connectorClient">Connector client instance for posting to Bot Framework.</param> /// <returns>Task tracking operation.</returns> private static async Task HandleTextMessagesAsync(Activity activity, ConnectorClient connectorClient) { if (activity.Text.Contains("GetChannels")) { Activity replyActivity = activity.CreateReply(); replyActivity.AddMentionToText(activity.From, MentionTextLocation.PrependText); ConversationList channels = connectorClient.GetTeamsConnectorClient().Teams.FetchChannelList(activity.GetChannelData <TeamsChannelData>().Team.Id); // Adding to existing text to ensure @Mention text is not replaced. replyActivity.Text = replyActivity.Text + " <p>" + string.Join("</p><p>", channels.Conversations.ToList().Select(info => info.Name + " --> " + info.Id)); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("GetTenantId")) { Activity replyActivity = activity.CreateReply(); replyActivity = replyActivity.AddMentionToText(activity.From, MentionTextLocation.PrependText); if (!activity.Conversation.IsGroup.GetValueOrDefault()) { replyActivity = replyActivity.NotifyUser(); } replyActivity.Text += " Tenant ID - " + activity.GetTenantId(); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("Create1on1")) { var response = connectorClient.Conversations.CreateOrGetDirectConversation(activity.Recipient, activity.From, activity.GetTenantId()); Activity newActivity = new Activity() { Text = "Hello", Type = ActivityTypes.Message, Conversation = new ConversationAccount { Id = response.Id }, }; await connectorClient.Conversations.SendToConversationAsync(response.Id, newActivity); } else if (activity.Text.Contains("GetMembers")) { var response = (await connectorClient.Conversations.GetConversationMembersAsync(activity.Conversation.Id)).AsTeamsChannelAccounts(); StringBuilder stringBuilder = new StringBuilder(); Activity replyActivity = activity.CreateReply(); replyActivity.Text = string.Join("</p><p>", response.ToList().Select(info => info.GivenName + " " + info.Surname + " --> " + info.ObjectId)); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("TestRetry")) { for (int i = 0; i < 15; i++) { Activity replyActivity = activity.CreateReply(); replyActivity.Text = "Message Count " + i; await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } } else if (activity.Text.Contains("O365Card")) { O365ConnectorCard card = CreateSampleO365ConnectorCard(); Activity replyActivity = activity.CreateReply(); replyActivity.Attachments = new List <Attachment>(); Attachment plAttachment = card.ToAttachment(); replyActivity.Attachments.Add(plAttachment); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("Signin")) { var userId = activity.From.Id; //if (userIdFacebookTokenCache.ContainsKey(userId)) //{ // // Use cached token // var token = userIdFacebookTokenCache[userId]; // try // { // // Send a thumbnail card with user's FB profile // var card = await CreateFBProfileCard(token); // Activity replyActivity = activity.CreateReply(); // replyActivity.Text = "Cached credential is found. Use cached token to fetch info."; // replyActivity.Attachments.Add(card); // await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); // } // catch (Exception) // { // await SendSigninCardAsync(activity, connectorClient); // } //} //else //{ // // No token cached: issue a new Signin card // await SendSigninCardAsync(activity, connectorClient); //} } else if (activity.Text.Contains("Signout")) { var userId = activity.From.Id; //userIdFacebookTokenCache.Remove(userId); Activity replyActivity = activity.CreateReply(); replyActivity.Text = "Your credential has been removed."; await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else if (activity.Text.Contains("GetTeamDetails")) { if (string.IsNullOrEmpty(activity.GetChannelData <TeamsChannelData>()?.Team?.Id)) { Activity replyActivity = activity.CreateReply(); replyActivity.Text = "This call can only be made from a Team."; await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } else { var teamDetails = await connectorClient.GetTeamsConnectorClient().Teams.FetchTeamDetailsAsync(activity.GetChannelData <TeamsChannelData>().Team.Id); Activity replyActivity = activity.CreateReply(); replyActivity.Text = "<p>Team Id " + teamDetails.Id + " </p>" + "<p>Team Name " + teamDetails.Name + " </p>" + "<p>Team AAD Group Id " + teamDetails.AadGroupId + " </p>"; await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } } else { var accountList = connectorClient.Conversations.GetConversationMembers(activity.Conversation.Id); Activity replyActivity = activity.CreateReply(); replyActivity.Text = "Help " + "<p>Type GetChannels to get List of Channels. </p>" + "<p>Type GetTenantId to get Tenant Id </p>" + "<p>Type Create1on1 to create one on one conversation. </p>" + "<p>Type GetMembers to get list of members in a conversation (team or direct conversation). </p>" + "<p>Type TestRetry to get multiple messages from Bot in throttled and retried mechanism. </p>" + "<p>Type O365Card to get a O365 actionable connector card. </p>" + "<p>Type Signin to issue a Signin card to sign in a Facebook app. </p>" + "<p>Type Signout to logout Facebook app and clear cached credentials. </p>" + "<p>Type GetTeamDetails to get details for the current team. </p>"; replyActivity = replyActivity.AddMentionToText(activity.From); await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); } }
public static Attachment GetFilter(string email) { var section = new O365ConnectorCardSection("Please select the option below to create Team"); // "C:\Users\v-washai\Downloads\Picture1.png" // var heroImage = new O365ConnectorCardSection(null, null, null, null, null, ""); var inputs = new List <O365ConnectorCardMultichoiceInputChoice>(); foreach (var member in MessagesController.GetMemberList(email)) { inputs.Add(new O365ConnectorCardMultichoiceInputChoice(member.Split('@').First(), member)); } var memberSelection = new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "members", true, "Select Team Members", null, inputs , "compact" , true); var createCustomTeam = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Create Custom Team", "createCustomTeam", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "teamName", true, "Enter Team Name", null, false, null), memberSelection }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Create Team", "Custom", @"{""TeamName"":""{{teamName.value}}"", ""Members"":""{{members.value}}""}") }); var createTeamForFlight = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Create Team for Upcoming Flight", "flightWiseTeam", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "flight", true, "Select flight", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("783", "783"), new O365ConnectorCardMultichoiceInputChoice("784", "784"), new O365ConnectorCardMultichoiceInputChoice("785", "785") }, "compact" , false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Create Team", "Flight", @"{""Value"":""{{flight.value}}""}") }); O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Title = "Welcome to FlightTeamCreationBot.", Summary = "", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { createTeamForFlight, createCustomTeam } }; return(card.ToAttachment()); }
public static Attachment GetCardsInformation() { var section = new O365ConnectorCardSection { ActivityTitle = "Track customer belongings", Text = "Using this bot you can<ol><li>Check baggage status</li><li>Track current location</li><li>Re-assign baggage</li><li>Report missing</li></ol> Choose one of the options below to retrieve details" }; var PNRNumberCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Baggage by PNR", "PNR", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "pnrNumberInput", true, "Enter PNR number (Ex:DBW6WK, DBW6WF, DBW6RK)", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show", Constants.PNR, @"{""Value"":""{{pnrNumberInput.value}}""}") }); var TicketNumnerCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Baggage by Ticket#", "Ticket Number", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "ticketNumberInput", true, "Enter Ticket number (Ex: DBW612, DBW634, DBW678)", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show", Constants.TicketNumber, @"{""Value"":""{{ticketNumberInput.value}}""}") }); var NameCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Baggage by Passenger Name", "Name", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "NameInput", true, "Enter Passenger Name( Ex: Adele, Alex, Allan)", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show", Constants.Name, @"{""Value"":""{{NameInput.value}}""}") }); O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Title = "Passenger Baggage Information", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { PNRNumberCard, TicketNumnerCard, NameCard } }; return(card.ToAttachment()); }