[英]Getting Office 365 Outlook User Photo through REST
I'm currently able to view the photo metadata using : 我目前可以使用来查看照片元数据:
GET https://outlook.office.com/api/v2.0/me/photo
and i'm able to get a correct response like this : 而且我能够得到这样的正确响应:
{
"@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/photo/$entity",
"@odata.id": "https://outlook.office.com/api/v2.0/Users('ddfcd489-628b-7d04-b48b-20075df800e5@1717622f-1d94-c0d4-9d74-f907ad6677b4')/photo",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"BA09D118\"",
"Id": "240X240",
"Width": 240,
"Height": 240
}
However I get NULL when I try to query : 但是,当我尝试查询时,我得到NULL:
GET https://outlook.office.com/api/v2.0/me/photo/$value
What might be the reason? 可能是什么原因?
I do not know the reason why it does not work with the alias "me" but if you use the @odata.id and request the value with the following request 我不知道为什么它不能与别名“ me”一起使用的原因 ,但是如果您使用@ odata.id并通过以下请求来请求值
https://outlook.office.com/api/v2.0/Users('ddfcd489-628b-7d04-b48b-20075df800e5@1717622f-1d94-c0d4-9d74-f907ad6677b4')/photo/$value
it works. 有用。
Fixed it.. I just had to include the content type in the header as: 修复它。我只需要在标题中包含内容类型,例如:
"Content-Type: image/jpg"
It works for both 'me' and 'odata id' 它适用于“我”和“数据ID”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.