简体   繁体   中英

Getting Outlook profile image in Vue as v-img src

I am trying to create a profile image that changes, depending on who is logged in so I cannot hardcode the email into the url

how would i go about this

html

<v-avatar size="128" absolute color="secondary">
    <v-img:src="`https://outlook.office.com/api/v2.0/Users${email}/photo/$value`" />
</v-avatar>

computed

email() {
    return this.staffMember.WorkEmail
},

Email is returned as devan@bsuregroup.co.za but no image is being displayed

According to the API docs URL you need to query for photo looks like this:

GET https://outlook.office.com/api/v2.0/Users('{user_id}')/photo/$value

You need to change your URL in the v-img element:

<v-avatar size="128" absolute color="secondary">
    <v-img:src="`https://outlook.office.com/api/v2.0/Users(${email})/photo/$value`" />
</v-avatar>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM