mardi 29 janvier 2019

Is it possible to send AdaptiveTextBlock placeholder value as parameter list to weapons call

We have an adaptive card where the user has a choice to select yes or no. On selecting YES, user is prompted to enter the keywords. After the user gives input in the textblock in adaptive card, the input has to be captured and sent as input parameter to web api.

The user input will be given in Placeholder of the AdaptiveTextInput block.

public static Attachment GetUserInputForCustomPPT()

    {

        AdaptiveCard card = new AdaptiveCard()

        {

            Id = "GetCustomPPT",

            Body = new List<AdaptiveElement>()

            {

                new AdaptiveTextBlock()

                {

                    Text = "Do you want to apply filter and customise the PPT?",

                    Wrap=true,

                   Size = AdaptiveTextSize.Small

                },

                new AdaptiveContainer()

                {

                    Id = "getCustomPPTNo",

                    SelectAction = new AdaptiveSubmitAction()

                   {

                        Id = "getCustomPPTNo",

                        Title = "No",

                        DataJson = "{ \"Type\": \"GetCustomPPT\" }",

                    }

                },

                new AdaptiveContainer()

                {

                    Id = "getCustomPPTYes",

                    Items = new List<AdaptiveElement>()

                    {

                        new AdaptiveTextBlock()

                        {

                            Text = "Please select an option",

                            Wrap=true,

                            Size = AdaptiveTextSize.Small

                        }

                    }

                },

            },

            Actions = new List<AdaptiveAction>()

            {

                new AdaptiveShowCardAction()

                {

                    Id = "GetPPTYes",

                    Title = "Yes",

                    Card = new AdaptiveCard()

                    {

                        Body = new List<AdaptiveElement>()

                        {

                            new AdaptiveTextBlock()

                            {

                                Text = "Please enter your input",

                                Wrap = true

                            },

                            new AdaptiveTextInput()

                            {

                                Id="GetUserInputKeywords",

                                Placeholder="Please enter the keyword list separated by ',' Ex:RPA,FS ",

                                MaxLength=490,

                                IsMultiline=true

                            }

                        },

                        Actions = new List<AdaptiveAction>()

                        {

                            new AdaptiveSubmitAction()

                            {

                                Id = "contactSubmit",

                                Title = "Submit",

                                DataJson = "{ \"Type\": \"GetPPT\" }"

                            },

                            new AdaptiveOpenUrlAction()

                            {

                                Id="CallApi",

                                Url=new Uri("https://xyz"+"RPA")

                                //card.Actions.Card.AdaptiveTextInput.Placeholder

                            }

                        }

                    }

                },





                 new AdaptiveShowCardAction()

                {



                    Id = "GetPPTNo",

                    Title = "No",

                    Card = new AdaptiveCard()

                    {

                        Body = new List<AdaptiveElement>()

                        {



                        },

                        Actions = new List<AdaptiveAction>()

                        {

                            new AdaptiveSubmitAction()

                            {

                                Id = "contactSubmit",

                                Title = "Submit",

                                DataJson = "{ \"Type\": \"GetPPTNo\" }"

                            }

                        }

                    }

                }

            }

        };

        // Create the attachment with adapative card. 

        Attachment attachment = new Attachment()

        {

            ContentType = AdaptiveCard.ContentType,

           Content = card

        };

        return attachment;

    }![enter image description here](https://i.stack.imgur.com/sFcAW.jpg)




Aucun commentaire:

Enregistrer un commentaire