Reputation: 191
I have a simple web app that for the past month or so the following was working:
outlook.office365.com/api/beta/Me/userphotos('120x120')/$value
but now it returns:
{"error":{"code":"RequestBrokerOld-ParseUri","message":"Resource not found for the segment 'userphotos'."}}
I get the same error if I try any of the following:
https://outlook.office365.com/api/beta/Me/userphoto
https://outlook.office365.com/api/beta/Me/userphotos
https://outlook.office365.com/api/beta/Me/userphoto/$value
It is possible that my organisation has changed something to cause this? Or has there been a general change in how this request works?
In the same app, my other email and calendar requests all work fine, this is simply just a cosmetic problem of not displaying the users profile pic in the top corner.
Upvotes: 2
Views: 460
Reputation: 191
This is really ElioStruyf's answer.
The endpoint is now called "photo" and not "userphoto"
To get the photo information you use:
https://outlook.office365.com/api/beta/Me/photo
To get the photo you call
https://outlook.office365.com/api/beta/Me/photo/$value
To get list of all available photo sizes, use this API endpoint -
https://outlook.office.com/api/beta/me/Photos/
Sample response -
{
"@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/Photos",
"value": [
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('48X48')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('48X48')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "48X48",
"Height": 48,
"Width": 48
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('64X64')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('64X64')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "64X64",
"Height": 64,
"Width": 64
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('96X96')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('96X96')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "96X96",
"Height": 96,
"Width": 96
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('120X120')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('120X120')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "120X120",
"Height": 120,
"Width": 120
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('240X240')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('240X240')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "240X240",
"Height": 240,
"Width": 240
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('360X360')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('360X360')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "360X360",
"Height": 360,
"Width": 360
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('432X432')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('432X432')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "432X432",
"Height": 432,
"Width": 432
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('504X504')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('504X504')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "504X504",
"Height": 504,
"Width": 504
},
{
"@odata.id": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('648X648')",
"@odata.readLink": "https://outlook.office.com/api/beta/Users('[email protected]')/Photos('648X648')",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"7A1F3A9D\"",
"Id": "648X648",
"Height": 648,
"Width": 648
}
]
}
To fetch actual blob of desired photo size, call this API -
https://outlook.office.com/api/beta/me/Photos('120X120')/$value
Upvotes: 2
Reputation: 5774
Nothing's wrong with your organization's office 365 configuration. Outlook UserPhoto API has stopped working with the given endpoint. Unfortunately, they haven't updated the documentation yet. Let's hope it will be up soon or they will at least update documentation with new API endpoint.
Upvotes: 1