【问题标题】:Cannot Get More Than Basic User Info with Microsoft Graph API无法使用 Microsoft Graph API 获取更多基本用户信息
【发布时间】:2023-03-27 08:57:01
【问题描述】:

按照 https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aad-tutorial#DeploymentAndPermissionsGrant 的说明操作后,当我尝试检索基本字段以外的任何内容时,我的 SharePoint Web 部件遇到错误。

例如,this 调用有效:

https://graph.microsoft.com/v1.0/users?$select=displayName,mail,userPrincipalName

但是,调用会导致501 Not Implemented异常`声明,“此操作目标尚不支持。”

https://graph.microsoft.com/v1.0/users?$select=displayName,mail,userPrincipalName,hireDate

在我的 package-solution.json 中:

"webApiPermissionRequests": [
  {
    "resource": "Microsoft Graph",
    "scope": "User.Read.All"
  }
]

调用脚本很简单,即:

this.context.msGraphClientFactory
  .getClient()
  .then((client: MSGraphClient): void => {
    // From https://github.com/microsoftgraph/msgraph-sdk-javascript sample
    client
      .api("users")
      .version("v1.0")
      .select("displayName,mail,userPrincipalName,hireDate")

我已经通过/_layouts/15/online/AdminHome.aspx#/webApiPermissionManagement页面批准了访问:

更新:我也尝试更新我的“package-solution.json to use the value Microsoft.Azure.AgregatorService rather than Microsoft Graph”,但在 API 管理页面(上面的屏幕截图)上尝试批准权限时,我收到此错误:

[HTTP]:400 - [CorrelationId]:5134e69e-f000-8000-b901-2a4b8bab60b8 [版本]:16.0.0.8929 - 找不到名为 Microsoft.Azure.AgregatorService 的服务主体。 参数名称:资源名称

我也没有看到我在 SharePoint Online 客户端扩展性 - Azure 门户中的权限下批准的权限(不确定我是否应该这样做,但我只是想提一下!)。

这是我的request-id,如果它可以帮助 Microsoft 的某个人弄清楚可能发生的事情!

ed3ff30c-d552-462e-be70-c69a19275049

【问题讨论】:

    标签: sharepoint microsoft-graph-api spfx


    【解决方案1】:

    Microsoft 已回复我的支持请求,指出当返回多个用户时,无法检索某些字段,即生日和雇用日期。当请求单个用户时,这些字段将在响应中可用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-13
      • 2021-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多