本文介绍了Office365 API-拉我的userphoto的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Web应用程序,在过去一个月左右的时间内,以下应用程序正在工作:

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

但现在它返回:

{"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.

推荐答案

这确实是 ElioStruyf 的答案

该终结点现在称为照片",而不是"userphoto"

The endpoint is now called "photo" and not "userphoto"

要获取照片信息,请使用:

To get the photo information you use:

https://outlook.office365.com/api/beta/Me/photo

要获取您打电话的照片

https://outlook.office365.com/api/beta/Me/photo/$value

要获取所有可用照片尺寸的列表,请使用此API端点-

To get list of all available photo sizes, use this API endpoint -

https://outlook.office.com/api/beta/me/Photos/

示例响应-

{
    "@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
        }
    ]
}

要获取所需照片尺寸的实际Blob,请调用此API-

To fetch actual blob of desired photo size, call this API -

https://outlook.office.com/api/beta/me/Photos('120X120')/$value

这篇关于Office365 API-拉我的userphoto的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 07:46