After authenticating against Azure AD, my bot is able to retrieve the current user photo from Microsoft Graph through the following code, which adds the photo to the response message as an attachment:
HttpClient client2 = new HttpClient();
client2.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var response2 = await client2.GetByteArrayAsync("https://graph.microsoft.com/v1.0/me/photo/$value");
Activity replyToConversation = (Activity)context.MakeMessage();
replyToConversation.Type = "message";
replyToConversation.Attachments.Add(new Attachment()
{
Content = response2,
ContentType = "image/jpeg"
});
await context.PostAsync(replyToConversation);
context.Wait(MessageReceivedAsync);
Everything works as expected in the Web Chat channel, but for some reason the picture is not displayed in the Microsoft Teams channel and the bot answers the default error message: "Sorry, my bot code is having an issue."
Please, any ideas?