Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BotFramework-Microsoft Teams #1434

Closed
Jatin-Chandarana opened this issue Dec 4, 2018 · 2 comments
Closed

BotFramework-Microsoft Teams #1434

Jatin-Chandarana opened this issue Dec 4, 2018 · 2 comments

Comments

@Jatin-Chandarana
Copy link

Jatin-Chandarana commented Dec 4, 2018

Hi,

We have developed Web App Bot and also we created new channel in Microsoft Teams. Hero card images rendering correctly in Web App bot but it does not render in Teams.

Same has been attached here.
error

@Jatin-Chandarana
Copy link
Author

I have written below line of code.
Activity reply = ((Activity)context.Activity).CreateReply();

            CardImage cimage = new CardImage();
            WebClient imageData = new WebClient();
            List<CardImage> cardImages = new List<CardImage>();
            List<CardAction> cardButtons = new List<CardAction>();

          reply.AttachmentLayout = AttachmentLayoutTypes.Carousel;
          reply.Attachments = new List<Attachment>();


            byte[] bytes = imageData.DownloadData(https://XXX.com/image.png);
            string image = Convert.ToBase64String(bytes, 0, bytes.Length);

            cimage.Url = "data:image/png;base64," + image;
           cimage.Alt = "Office 365";

           cardImages.Add(cimage);

          CardAction cardButton = new CardAction()
            {
                Value = "https://en.wikipedia.org/wiki/Office_365",
                Type = ActionTypes.OpenUrl,
                Title = "Learn More"
            };
         cardButtons.Add(cardButton);

            HeroCard card = new HeroCard
            {
                
                Title = "Office 365",
                Subtitle = "Office 365 is the brand name Microsoft uses for a group of subscriptions that provide productivity software and related services.",
                Images = cardImages,
                Buttons = cardButtons
            };

Attachment attacheent = card.ToAttachment();
attacheent.Name = "Office 365";

            attacheent.ContentType = "application/vnd.microsoft.card.hero";

            reply.Attachments.Add(attacheent);

FYI: Image Dimension is 350 * 267

@EricDahlvang
Copy link
Member

Hi @Jatin-Chandarana

There is an open issue related to base64 encoded images not rendering in MS Teams right now: OfficeDev/BotBuilder-MicrosoftTeams#172 Please follow along there for updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants