Esempio n. 1
0
        public Attachment CreateAdaptiveCardAttachment(string filePath, object data = null)
        {
            var adaptiveCardJson = string.Empty;

            if (data != null)
            {
                adaptiveCardJson = TemplateHandler.RenderFile(filePath, data);
            }
            else
            {
                adaptiveCardJson = File.ReadAllText(filePath);
            }

            var adaptiveCardAttachment = new Attachment()
            {
                ContentType = "application/vnd.microsoft.card.adaptive",
                Content     = JsonConvert.DeserializeObject(adaptiveCardJson),
            };

            return(adaptiveCardAttachment);
        }