예제 #1
0
        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());
        }