public const string BaseUrl = "https://contosoairline.azurewebsites.net"; //"https://50f24fb4.ngrok.io"; public static O365ConnectorCard GetO365ConnectorCard(Passenger passenger) { var section = new O365ConnectorCardSection { Title = "Passenger Details", ActivityTitle = passenger.Name, ActivitySubtitle = $"Flight: **{passenger.FlightNumber}** Seat: **{passenger.Seat}** Gate= **{passenger.GateNumber}**", ActivityText = $"Special Instruction: { (string.IsNullOrEmpty(passenger.SpecialAssistance) ? "None" : passenger.SpecialAssistance)}", ActivityImage = BaseUrl + $"/public/resources/{GetPictureName(passenger.Name)}.jpg", Facts = new List <O365ConnectorCardFact> { new O365ConnectorCardFact("From", passenger.From), new O365ConnectorCardFact("To", passenger.To), new O365ConnectorCardFact("Date", passenger.DepartureTime.ToString("d MMM yy")), new O365ConnectorCardFact("Class", passenger.Class), new O365ConnectorCardFact("PNR", passenger.PNR), new O365ConnectorCardFact("Frequent Flyer", string.IsNullOrEmpty(passenger.FrequentFlyerNumber)? "No" : passenger.FrequentFlyerNumber), new O365ConnectorCardFact("Loyalty Status", passenger.LoyaltyStatus.ToString()) } }; O365ConnectorCard card = new O365ConnectorCard() { ThemeColor = "#E67A9E", Sections = new List <O365ConnectorCardSection> { section }, }; return(card); }
public void O365ConnectorCardSectionInitsWithNoArgs() { var section = new O365ConnectorCardSection(); Assert.NotNull(section); Assert.IsType <O365ConnectorCardSection>(section); }
/// <summary> /// Add link button /// </summary> /// <param name="linkButtonText">Button text</param> /// <param name="linkTargetUri">Target Uri</param> public void AddLinkToCurrentMessageCard(string linkTargetUri, string linkButtonText) { var link = new O365ConnectorCardOpenUri("OpenUri", linkButtonText, null, new List <O365ConnectorCardOpenUriTarget> { new O365ConnectorCardOpenUriTarget("default", linkTargetUri) }); if (_currentSection == null) { _currentSection = new O365ConnectorCardSection(); _card.Sections = new List <O365ConnectorCardSection> { _currentSection }; } if (_currentSection.PotentialAction == null || !_currentSection.PotentialAction.Any()) { _currentSection.PotentialAction = new List <O365ConnectorCardActionBase> { link }; } else { _currentSection.PotentialAction.Add(link); } }
/// <summary> /// connector card with title, actvity title, facts in section sample /// </summary> /// <returns></returns> public static Attachment O365ConnectorCardFactsInSection() { 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 }, }; Attachment attachment = new Attachment() { ContentType = O365ConnectorCard.ContentType, Content = o365connector }; return(attachment); }
/// <summary> /// Add an event within a sub section /// </summary> /// <param name="severity">Severity of event</param> /// <param name="log">Event text</param> public void AddLogToCurrentMessageCard(LogSeverity severity, string log) { var formattedLog = $"<span style=\"color:#{GetColorCode(severity)}\"><strong>{severity}</strong></span> {log}"; if (severity == LogSeverity.Error) { _hasException = true; } if (severity == LogSeverity.Warn) { _hasWarning = true; } if (_card.Sections == null || !_card.Sections.Any()) { var section = new O365ConnectorCardSection(formattedLog); _card.Sections = new List <O365ConnectorCardSection> { section }; _currentSection = section; } else { _currentSection.Title = string.IsNullOrEmpty(_currentSection.Title) ? formattedLog : _currentSection.Title + "<br />" + formattedLog; } }
/// <summary> /// Add new section to running log card /// </summary> /// <param name="severity">Optional: severity of the section</param> /// <param name="title">Optional: Title of the section</param> /// <param name="text">Optional: Summary of the section</param> /// <param name="eventTitle">Optional: Section event title</param> /// <param name="eventSubtitle">Optional: Section event subtitle</param> /// <param name="eventSummary">Optional: Section event summary</param> /// <param name="markdown">If any text has markdown</param> public void CreateNewMessageCard(LogSeverity?severity = null, string title = null, string text = null, string eventTitle = null, string eventSubtitle = null, string eventSummary = null, bool?markdown = null) { if (severity.HasValue && severity.Value == LogSeverity.Error) { _hasException = true; } if (severity.HasValue && severity.Value == LogSeverity.Warn && !_hasException) { _hasWarning = true; } var section = new O365ConnectorCardSection(title, text, eventTitle, eventSubtitle, eventSummary, null, null, markdown); if (_card.Sections == null || !_card.Sections.Any()) { _card.Sections = new List <O365ConnectorCardSection> { section }; } else { _card.Sections.Add(section); } _currentSection = section; }
/// <summary> /// Add new exception section to running log card /// </summary> /// <param name="exception">Exception</param> /// <param name="linkToLog">Uri to log file</param> /// <param name="logButtonText">Name of link button</param> public void CreateNewExceptionMessageCard(Exception exception, string linkToLog = null, string logButtonText = null) { _hasException = true; var innerException = string.Empty; if (!string.IsNullOrEmpty(exception.InnerException?.Message)) { innerException = $"{Environment.NewLine}{exception.InnerException.Message}"; } var section = new O365ConnectorCardSection($"{exception.GetType()} - {exception.Message}{innerException}", null, null, null, $"```{Environment.NewLine}{exception.StackTrace}{Environment.NewLine}```", null, null, true); _currentSection = section; if (!string.IsNullOrEmpty(linkToLog)) { AddLinkToCurrentMessageCard(linkToLog, logButtonText ?? "Log"); } if (_card.Sections == null || !_card.Sections.Any()) { _card.Sections = new List <O365ConnectorCardSection> { _currentSection }; } else { _card.Sections.Add(_currentSection); } _currentSection = new O365ConnectorCardSection(); _card.Sections.Add(_currentSection); }
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()); }
// Helps create an O365 actionable message for a particular task. public static O365ConnectorCard CreateCardForInterviewRequest(InterviewRequest request) { var random = new Random(); O365ConnectorCard actionableCard = new O365ConnectorCard() { Sections = new List <O365ConnectorCardSection>() }; O365ConnectorCardSection section = new O365ConnectorCardSection() { ActivityTitle = request.Candidate.Name, ActivitySubtitle = $"For position: {request.PositionTitle}", ActivityText = $"Req ID: {request.ReqId}", ActivityImage = request.Candidate.ProfilePicture, PotentialAction = new List <O365ConnectorCardActionBase>() }; // Add a more complex form action O365ConnectorCardActionCard updateDateAction = new O365ConnectorCardActionCard(type: "ActionCard") { Id = "updateInterviewDate", Name = "Set interview date", Actions = new List <O365ConnectorCardActionBase>(), Inputs = new List <O365ConnectorCardInputBase>() }; updateDateAction.Actions.Add(new O365ConnectorCardHttpPOST("HttpPOST", "Schedule", "scheduleInterview", request.ReqId)); updateDateAction.Inputs.Add(new O365ConnectorCardDateInput("DateInput", "interviewDate", false, "Interview date", new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day).ToString("MMM d, yyyy"), false)); section.PotentialAction.Add(updateDateAction); actionableCard.Sections.Add(section); return(actionableCard); }
/// <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_O365ConnectorCard() { var section = new O365ConnectorCardSection( "This is the **section's title** property", "This is the section's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "This is the section's activityTitle property", "This is the section's activitySubtitle property", "This is the section's activityText property.", "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg", new List <O365ConnectorCardFact>() { new O365ConnectorCardFact("This is a fact name", "This is a fact value"), new O365ConnectorCardFact("This is a fact name", "This is a fact value"), new O365ConnectorCardFact("This is a fact name", "This is a fact value") }, new List <O365ConnectorCardImage>() { new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg"), new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg"), new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg") }, new List <O365ConnectorCardActionBase>() { new O365ConnectorCardViewAction() { Type = O365ConnectorCardViewAction.ContentType, Name = "View", Target = new List <string>() { "http://microsoft.com" } }, new O365ConnectorCardViewAction() { Type = O365ConnectorCardViewAction.ContentType, Name = "View", Target = new List <string>() { "http://microsoft.com" } } }); var card = new O365ConnectorCard( "This is the card title property", "This is the card's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "This is the summary property", "E81123", new List <O365ConnectorCardSection>() { section }); this.TestCard(new Attachment { Content = card, 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 static O365ConnectorCard GetO365ConnectorCardResult(Baggage baggage) { var section = new O365ConnectorCardSection { ActivityTitle = $"Name: **{baggage.Name}**", ActivitySubtitle = $"Ticket: **{baggage.TicketNo}** PNR: **{baggage.PNR}**", ActivityImage = "https://airlinebaggage.azurewebsites.net/resources/" + SplitName(baggage.Name) + ".jpg", Facts = new List <O365ConnectorCardFact> { new O365ConnectorCardFact("From", baggage.From), new O365ConnectorCardFact("To", baggage.To), new O365ConnectorCardFact("Number of Checked in Bags", baggage.BagCount.ToString()), new O365ConnectorCardFact("Current Status", baggage.CurrentStatus), new O365ConnectorCardFact("Baggage Identifer Number", baggage.BaggageIdentifer.ToString()) } }; var RebookingCard1 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Rebook Baggage", "PNR", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "flightNumberInput", true, "Enter new flight number (Ex: 220, 350, 787)", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Rebook", Constants.RebookBaggage, @"{""flightNumberInput"":""{{flightNumberInput.value}}""/*, ""pnrNumberInput"": ""{{pnrNumberInput.value}}""*/}") }); O365ConnectorCard card = new O365ConnectorCard() { Title = "Baggage Details", ThemeColor = "#E67A9E", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { RebookingCard1, new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Report Missing", Constants.ReportMissing, baggage.PNR) } }; return(card); }
public static O365ConnectorCard GetO365ConnectorCardResult(FlightInfo flight) { var section = new O365ConnectorCardSection { ActivityTitle = $"Flight number: **{flight.FlightNumber}**", ActivitySubtitle = $"PNR: **{flight.PNR}**", ActivityImage = "https://flightinfobot.azurewebsites.net/resources/Airline-Flight-Bot-03.png", Facts = new List <O365ConnectorCardFact> { new O365ConnectorCardFact("From", flight.FromCity), new O365ConnectorCardFact("To", flight.ToCity), new O365ConnectorCardFact("Date of Journey", flight.JourneyDate.ToShortDateString()) } }; var PNRNumberCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Rebook the Passenger", "PNR", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "pnrNumberInput", true, "Enter PNR number", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Rebook the Passenger", Constants.Rebook, @"{""pnrNumberInput"":""{{pnrNumberInput.value}}"", ""flightNumberInput"":" + flight.FlightNumber + " }") }); O365ConnectorCard card = new O365ConnectorCard() { Title = "Rebook Passenger", ThemeColor = "#E67A9E", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { PNRNumberCard } }; return(card); }
public async Task NotifyAboutStageChange( Candidate candidate, CancellationToken cancellationToken = default) { var subscribers = await _databaseContext.SubscribeEvents.ToArrayAsync(cancellationToken); var configurationCompletedCard = new O365ConnectorCardSection( activityTitle: $"Stage has been changed for {candidate.Name}", activityImage: $"{_appSettings.BaseUrl}/api/candidates/{candidate.CandidateId}/profilePicture", facts: new List <O365ConnectorCardFact> { new O365ConnectorCardFact("Stage:", $"**{candidate.PreviousStage.ToString()}** --> **{candidate.Stage.ToString()}**"), new O365ConnectorCardFact("Current role:", candidate.CurrentRole), new O365ConnectorCardFact("Location:", candidate.Location?.LocationAddress ?? string.Empty), new O365ConnectorCardFact("Position applied:", candidate.Position.Title), new O365ConnectorCardFact("Phone number:", candidate.Phone) }, markdown: true); if (candidate.Comments.Any() || candidate.Interviews.Any()) { var contentUrl = $"{_appSettings.BaseUrl}/StaticViews/CandidateFeedback.html?{Uri.EscapeDataString($"candidateId={candidate.CandidateId}")}"; var openFeedback = new Uri(string.Format( CommonConstants.TaskModuleUrlFormat, _appSettings.TeamsAppId, contentUrl, "Feedback for " + candidate.Name, _appSettings.MicrosoftAppId, "large", "large")); configurationCompletedCard.PotentialAction = new List <O365ConnectorCardActionBase> { new O365ConnectorCardViewAction(O365ConnectorCardViewAction.Type) { Name = "Open candidate feedback", Target = new List <string> { openFeedback.ToString() } } }; } var connectorCard = new O365ConnectorCard { Sections = new List <O365ConnectorCardSection> { configurationCompletedCard }, Summary = $"Stage has been changed for {candidate.Name}" }; var taskList = subscribers.Select(subscriber => _connectorService.SendToChannelAsync(subscriber.WebhookUrl, connectorCard, cancellationToken)); await Task.WhenAll(taskList); }
public static O365ConnectorCard GetO365ConnectorCard(Baggage baggage) { var section = new O365ConnectorCardSection { ActivityTitle = $"Name: **{baggage.Name}**", ActivitySubtitle = $"Ticket: **{baggage.TicketNo}** PNR: **{baggage.PNR}**", ActivityImage = "https://airlinebaggage.azurewebsites.net/resources/" + SplitName(baggage.Name) + ".jpg" }; var RebookingCard = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Rebook Baggage", "PNR", new List <O365ConnectorCardInputBase> { new O365ConnectorCardTextInput( O365ConnectorCardTextInput.Type, "flightNumberInput", true, "Enter new flight number(Ex: 220, 350, 787)", null, false, null) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Rebook", Constants.RebookBaggage, @"{""flightNumberInput"":""{{flightNumberInput.value}}""/*, ""pnrNumberInput"": ""{{pnrNumberInput.value}}""*/}") }); O365ConnectorCard card = new O365ConnectorCard() { Title = "What do you want to do?", ThemeColor = "#E67A9E", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Show Baggage Details", Constants.CurrentStatus, $"{{'Value':'{baggage.PNR}'}}"), RebookingCard, new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Report Missing", Constants.ReportMissing, baggage.PNR) } }; return(card); }
public static O365ConnectorCard GetO365ConnectorCardResult(AirCraftInfo flight, string actionId) { var section = new O365ConnectorCardSection { ActivityTitle = $"Aircraft Id: **{flight.AircraftId}**", ActivitySubtitle = $"Model: **{flight.Model}**", ActivityImage = "https://fleetinfobot.azurewebsites.net/resources/Airline-Fleet-Bot-02.png", Facts = new List <O365ConnectorCardFact> { new O365ConnectorCardFact("Base location", flight.BaseLocation), new O365ConnectorCardFact("Capacity", flight.Capacity), new O365ConnectorCardFact("Flight type", flight.FlightType), new O365ConnectorCardFact("Status", flight.Status.ToString()) } }; var actions = new List <O365ConnectorCardActionBase>(); switch (flight.Status) { case Status.Available: actions.Add(new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Assign the new aircraft", Constants.Assignaircraft, $"{{'FlightNumber':'{flight.FlightNumber}','AircraftId':'{flight.AircraftId}', 'ActionId':'{actionId}'}}")); actions.Add(new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Mark as grounded", Constants.MarkGrounded, $"{{'FlightNumber':'{flight.FlightNumber}','AircraftId':'{flight.AircraftId}','ActionId':'{actionId}'}}")); break; case Status.Assigned: actions.Add(new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Mark as grounded", Constants.MarkGrounded, $"{{'FlightNumber':'{flight.FlightNumber}','AircraftId':'{flight.AircraftId}', 'ActionId':'{actionId}'}}")); break; case Status.Grounded: actions.Add(new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Mark as available", Constants.Available, $"{{'FlightNumber':'{flight.FlightNumber}','AircraftId':'{flight.AircraftId}', 'ActionId':'{actionId}'}}")); break; default: break; } O365ConnectorCard card = new O365ConnectorCard() { Title = "Assign an Aircraft", ThemeColor = "#E67A9E", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = actions }; return(card); }
public O365ConnectorCard Convert(Candidate candidate, O365ConnectorCard destination, ResolutionContext context) { var baseUrl = ConfigurationManager.AppSettings["BaseUrl"]; var configurationCompletedCard = new O365ConnectorCardSection( activityTitle: $"Stage has been changed for {candidate.Name}", activityImage: $"{baseUrl}/api/candidates/{candidate.CandidateId}/profilePicture", facts: new List <O365ConnectorCardFact> { new O365ConnectorCardFact("Stage:", $"**{candidate.PreviousStage.ToString()}** --> **{candidate.Stage.ToString()}**"), new O365ConnectorCardFact("Current role:", candidate.CurrentRole), new O365ConnectorCardFact("Location:", candidate.Location?.LocationAddress ?? string.Empty), new O365ConnectorCardFact("Position applied:", candidate.Position.Title), new O365ConnectorCardFact("Phone number:", candidate.Phone) }, markdown: true ); if (candidate.Comments.Any() || candidate.Interviews.Any()) { var contentUrl = $"{baseUrl}/StaticViews/CandidateFeedback.html?{Uri.EscapeDataString($"candidateId={candidate.CandidateId}")}"; var openFeedback = new Uri(string.Format(CommonConstants.TaskModuleUrlFormat, ConfigurationManager.AppSettings["TeamsAppId"], contentUrl, "Feedback for " + candidate.Name, ConfigurationManager.AppSettings["MicrosoftAppId"], "large", "large")); configurationCompletedCard.PotentialAction = new List <O365ConnectorCardActionBase> { new O365ConnectorCardViewAction(O365ConnectorCardViewAction.Type) { Name = "Open candidate feedback", Target = new List <string> { openFeedback.ToString() } } }; } var card = new O365ConnectorCard { Sections = new List <O365ConnectorCardSection> { configurationCompletedCard }, Summary = $"Stage has been changed for {candidate.Name}" }; return(card); }
public void O365ConnectorCardSectionInits() { var title = "Donut Selection"; var text = "Choose a Donut"; var activityTitle = "Donut"; var activitySubtitle = "Select an image below."; var activityText = "Select the image of the donut you wish to order."; var activityImage = "https://example-of-donut.com"; var activityImageType = "article"; var markdown = false; var facts = new List <O365ConnectorCardFact>() { new O365ConnectorCardFact("jelly"), new O365ConnectorCardFact("powdered"), }; var images = new List <O365ConnectorCardImage>() { new O365ConnectorCardImage("https://jelly.com"), new O365ConnectorCardImage("https://powdered.com") }; var potentialAction = new List <O365ConnectorCardActionBase>() { new O365ConnectorCardActionBase("OpenUri") }; var section = new O365ConnectorCardSection(title, text, activityTitle, activitySubtitle, activityText, activityImage, activityImageType, markdown, facts, images, potentialAction); Assert.NotNull(section); Assert.IsType <O365ConnectorCardSection>(section); Assert.Equal(title, section.Title); Assert.Equal(text, section.Text); Assert.Equal(activityTitle, section.ActivityTitle); Assert.Equal(activitySubtitle, section.ActivitySubtitle); Assert.Equal(activityText, section.ActivityText); Assert.Equal(activityImage, section.ActivityImage); Assert.Equal(activityImageType, section.ActivityImageType); Assert.Equal(markdown, section.Markdown); Assert.Equal(facts, section.Facts); Assert.Equal(2, section.Facts.Count); Assert.Equal(images, section.Images); Assert.Equal(2, section.Images.Count); Assert.Equal(potentialAction, section.PotentialAction); Assert.Equal(1, section.PotentialAction.Count); }
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 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()); }
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> /// Create a sample O365 connector card. /// </summary> /// <returns>The result card with actions.</returns> private static O365ConnectorCard CreateSampleO365ConnectorCard() { var actionCard1 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Multiple Choice", "card-1", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-1", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice 1", "1"), new O365ConnectorCardMultichoiceInputChoice("Choice 2", "2"), new O365ConnectorCardMultichoiceInputChoice("Choice 3", "3") }, "expanded", true), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-2", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice 4", "4"), new O365ConnectorCardMultichoiceInputChoice("Choice 5", "5"), new O365ConnectorCardMultichoiceInputChoice("Choice 6", "6") }, "compact", true), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-3", false, "Pick an option", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice a", "a"), new O365ConnectorCardMultichoiceInputChoice("Choice b", "b"), new O365ConnectorCardMultichoiceInputChoice("Choice c", "c") }, "expanded", false), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-4", false, "Pick an option", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice x", "x"), new O365ConnectorCardMultichoiceInputChoice("Choice y", "y"), new O365ConnectorCardMultichoiceInputChoice("Choice z", "z") }, "compact", false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Send", "card-1-btn-1", @"{""list1"":""{{list-1.value}}"", ""list2"":""{{list-2.value}}"", ""list3"":""{{list-3.value}}"", ""list4"":""{{list-4.value}}""}") }); var actionCard2 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Text Input", "card-2", 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", "card-2-btn-1", @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}") }); var actionCard3 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Date Input", "card-3", 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", "card-3-btn-1", @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}") }); 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> { actionCard1, actionCard2, actionCard3, 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); }
public void CardTests_O365ConnectorCard() { var actionCard1 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Multiple Choice", "card-1", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-1", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice 1", "1"), new O365ConnectorCardMultichoiceInputChoice("Choice 2", "2"), new O365ConnectorCardMultichoiceInputChoice("Choice 3", "3") }, "expanded", true), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-2", true, "Pick multiple options", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice 4", "4"), new O365ConnectorCardMultichoiceInputChoice("Choice 5", "5"), new O365ConnectorCardMultichoiceInputChoice("Choice 6", "6") }, "compact", true), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-3", false, "Pick an option", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice a", "a"), new O365ConnectorCardMultichoiceInputChoice("Choice b", "b"), new O365ConnectorCardMultichoiceInputChoice("Choice c", "c") }, "expanded", false), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-4", false, "Pick an option", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Choice x", "x"), new O365ConnectorCardMultichoiceInputChoice("Choice y", "y"), new O365ConnectorCardMultichoiceInputChoice("Choice z", "z") }, "compact", false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Send", "card-1-btn-1", @"{""list1"":""{{list-1.value}}"", ""list2"":""{{list-2.value}}"", ""list3"":""{{list-3.value}}"", ""list4"":""{{list-4.value}}""}") }); var actionCard2 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Text Input", "card-2", 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", "card-2-btn-1", @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}") }); var actionCard3 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Date Input", "card-3", 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", "card-3-btn-1", @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}") }); var section = new O365ConnectorCardSection( "This is the **section's title** property", "This is the section's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "This is the section's activityTitle property", "This is the section's activitySubtitle property", "This is the section's activityText property.", "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg", "avatar", true, new List <O365ConnectorCardFact>() { new O365ConnectorCardFact("This is a fact name", "This is a fact value"), new O365ConnectorCardFact("This is a fact name", "This is a fact value"), new O365ConnectorCardFact("This is a fact name", "This is a fact value") }, new List <O365ConnectorCardImage>() { new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg"), new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg"), new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg") }, new List <O365ConnectorCardActionBase>() { new O365ConnectorCardViewAction( O365ConnectorCardViewAction.Type, "View", null, new List <string>() { "http://microsoft.com" }), new O365ConnectorCardViewAction( O365ConnectorCardViewAction.Type, "View", null, new List <string>() { "http://microsoft.com" }), }); O365ConnectorCard card = new O365ConnectorCard() { Summary = "This is the summary property", ThemeColor = "E81123", Title = "This is the card title property", Text = "This is the card's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { actionCard1, actionCard2, actionCard3, 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" } }) } }; this.TestCard(new Attachment { Content = card, ContentType = O365ConnectorCard.ContentType }); }
public static O365ConnectorCard GetConnectorCard() { var section = new O365ConnectorCardSection( null, null, null, null, null, null, true, new List <O365ConnectorCardFact> { new O365ConnectorCardFact("Gmail", "All your gmail actions in Teams"), new O365ConnectorCardFact("Wiki", "Know all the facts around the world"), new O365ConnectorCardFact("VSTS", "Know all your task details"), }); var actionCard1 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Run This Command", "card-1", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-1", false, "Select Command", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Gmail", "gmail"), new O365ConnectorCardMultichoiceInputChoice("Wiki", "wiki"), new O365ConnectorCardMultichoiceInputChoice("VSTS", "vsts") }, "compact", false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Run", "card-1-btn-1", @"{""list1"":""{{list-1.value}}""}") }); var actionCard2 = new O365ConnectorCardActionCard( O365ConnectorCardActionCard.Type, "Know this Command", "card-2", new List <O365ConnectorCardInputBase> { new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-2", false, "Select Command", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Gmail", "gmail"), new O365ConnectorCardMultichoiceInputChoice("Wiki", "wiki"), new O365ConnectorCardMultichoiceInputChoice("VSTS", "vsts") }, "compact", false), new O365ConnectorCardMultichoiceInput( O365ConnectorCardMultichoiceInput.Type, "list-3", false, "Select Command -2", null, new List <O365ConnectorCardMultichoiceInputChoice> { new O365ConnectorCardMultichoiceInputChoice("Gmail-2", "gmail"), new O365ConnectorCardMultichoiceInputChoice("Wiki-2", "wiki"), new O365ConnectorCardMultichoiceInputChoice("VSTS-2", "vsts") }, "compact", false) }, new List <O365ConnectorCardActionBase> { new O365ConnectorCardHttpPOST( O365ConnectorCardHttpPOST.Type, "Show help", "card-2-btn-2", @"{""list2"":""{{list-2.value}}"",""list3"":""{{list-3.value}}""}") }); O365ConnectorCard card = new O365ConnectorCard() { Summary = "O365 card summary", ThemeColor = "#E67A9E", Title = "Supported commands:", Text = "These are all your integrations:", Sections = new List <O365ConnectorCardSection> { section }, PotentialAction = new List <O365ConnectorCardActionBase> { actionCard1, actionCard2 } }; return(card); }
/// <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> /// 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()); }