REST API更改Azure Active Directory用户配置文件图片

问题描述

我正在使用https://login.microsoftonline.com/emailid/oauth2/v2.0/token获取具有请求表单参数的Graph API的访问令牌

  {"username",email },{ "password",password },{ "grant_type","password" },{ "client_id",ClientId },{ "scope",scope },{ "response_type","id_token" }

我正在获取访问令牌,然后点击此API:

https://graph.microsoft.com/v1.0/users/emailid/photo/$value

之前,我得到了回复

{
  "error": {
    "code": "OrganizationFromTenantGuidNotFound","message": "The tenant for tenant guid 'tenant id' does not exist.","innerError": {
      "requestId": "b3ea4878-1234-49be-bc66-c49aa224f9e6","date": "2020-08-23T07:28:21","request-id": "b3ea4878-1234-49be-bc66-c49aa224f9e6"
    }
  }
}

此后,我在MS Teams应用中登录并重试,响应更改为

{
  "error": {
    "code": "ResourceNotFound","message": "Resource Could not be discovered.","innerError": {
      "date": "2020-08-23T11:03:49","request-id": "c675a441-1234-4c29-9de0-7a5530b2fa53"
    }
  }
}

我尝试在Graph API Explorer和Postman中调用REST API,结果是相同的。

然后,我尝试使用Outlook API。 https://outlook.office.com/api/v2.0/me/photo/$value回复

{
    "error": {
        "code": "MailBoxNotEnabledForRESTAPI","message": "REST API is not yet supported for this mailBox."
    }
}

没有为用户启用邮箱,因此可以理解该消息。但是我想知道,是否有任何方法可以在azure活动目录中更改用户的个人资料图片。并且用户仅使用ms团队。如果我从MS Teams应用程序更改图片,那么它会反映到各个地方,例如Teams应用程序,广告用户页面或Microsoft帐户设置页面。我想要类似的东西,从代码中更改图片,并在各处反映出更改。

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)