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

show ms graph user photo in an adaptive card #6290

Closed
afahmy11 opened this issue Mar 6, 2021 · 3 comments
Closed

show ms graph user photo in an adaptive card #6290

afahmy11 opened this issue Mar 6, 2021 · 3 comments
Assignees
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. Needs-triage A new issue that require triage Support

Comments

@afahmy11
Copy link

afahmy11 commented Mar 6, 2021

hi

i am getting the user photo using an api call to https://graph.microsoft.com/v1.0/users/{id}/photo/$value . and i want to display it in an adaptive card that accepts a url. how can i do that

@afahmy11 afahmy11 added the Needs-triage A new issue that require triage label Mar 6, 2021
@stevkan stevkan added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-reported Required for internal Azure reporting. Do not delete. labels Mar 8, 2021
@v-kydela
Copy link

v-kydela commented Mar 8, 2021

Thank you for the question, @afahmy11

Adaptive Cards can only display public images. They cannot access URL's that require authorization, though Matt Hidinger says they have plans to solve that problem.

In the meantime you have two options, though both are somewhat undesirable.

  1. You can reupload the image to a public URL, which may be considered a security breach if the image is meant to be private.
  2. If the image is very small, you can embed the image in the card. If you don't know how to do that, you should be able to find plenty of posts explaining how to use data URI's. Be warned that embedding images that aren't small enough will make the activity too large to be sent through the Bot Framework, and you'll see errors in that case.

If you have further questions, please feel free to ask them on Stack Overflow. I will close this issue as resolved.

@v-kydela v-kydela closed this as completed Mar 8, 2021
@v-kydela v-kydela added the customer-replied-to Required for internal reporting. Do not delete. label Mar 8, 2021
@afahmy11
Copy link
Author

afahmy11 commented Mar 9, 2021

thanks a lot v-kydela

i have used the below in my adaptive card and it works but i am still confused on how to add the variable where i stored the output of https://graph.microsoft.com/v1.0/users/{id}/photo/$value in the "url" line

``

    "type": "AdaptiveCard",
    "body": [
    {
        "type": "Image",
        "style": "Person",
        "url": "data:image/png;base64,iVBORw0KGgoAAA ANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4 //8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU 5ErkJggg==",
        "size": "Small"
    }

@afahmy11
Copy link
Author

afahmy11 commented Mar 9, 2021

i tried "url": "data:image/png;base64,${user.photo}", but it is not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. Needs-triage A new issue that require triage Support
Projects
None yet
Development

No branches or pull requests

4 participants