设置配置文件图片

设置配置文件图片

本文介绍了Azure AD B2C图表Api-获取/设置配置文件图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

对于我的一个仪表板,出于明显的个性化原因,我想向用户显示其个人资料图片,并为他们提供更改的可能性.

For one of my dashboards I want to show the user their profile picture for obvious personalisation reasons, and offer them the possibility to change it.

Microsoft Docs网站上的大多数博客文章和文章都提到了可以用来获取这些数据的各种端点,但是我只是无法通过简单的邮递员电话就可以使用它.由于我什至无法获取照片,所以我也不知道如何更改(更新)它.

Most blog posts and articles on the Microsoft Docs site name a variety of endpoints I can leverage to get this data, but I'm just unable to get this to work with a simple postman call. Since I can't even get the photo, I wouldn't know how to change (update) it either.

以下端点不起作用:

  • 获取https://graph.microsoft.com/beta/users/{id}/photo/$ value
  • 获取https://graph.microsoft.com/beta/users/{id}/照片
  • 获取https://graph.windows.net/myorganization/users/{id}/photo?api-version=1.6
  • 获取https://graph.windows.net/myorganization/users/{id}/photo/$value?api-version=1.6

所有这些要么导致资源'照片'不存在,要么导致json响应中出现'内部服务器错误'.

All of them either result in an "resource 'photo' does not exist, or 'Internal server errors' in the json response.

注意:我可以查询图api来获取其他资源.

Note: I can query the graph api perfectly fine for other resources.

推荐答案

对于遇到B2C相同问题的任何人,请尝试使用"thumbnailPhoto"端点.这对我有用(特别是GET方法).

For anyone running into the same issue with B2C, try using the "thumbnailPhoto" endpoint. This worked for me (the GET method, specifically).

https://graph.windows.net/[tenant]/users/[objectid]/thumbnailPhoto?api-version=1.6

这篇关于Azure AD B2C图表Api-获取/设置配置文件图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 17:02