“租户指南的租户不存在"即使用户列在用户端点上? [英] "The tenant for tenant guid does not exist" even though user is listed on users endpoint?

查看:36
本文介绍了“租户指南的租户不存在"即使用户列在用户端点上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与 Outlook 的 API 集成(更具体地说,我想列出用户的联系人,并能够对其进行一些 CRUD).

I'm trying to integrate with Outlook's APIs (more specifically I want to list a users' contacts, and be able to do some CRUD on them).

我在 Azure 上创建了一个 Azure 帐户、一个 Office 365 开发人员帐户和一个应用程序.

I created an Azure account, an Office 365 developer account, and an application on Azure.

我可以使用登录端点获取访问令牌,如下所示:

I am able to get an access token using the login endpoint, like below:

https://login.microsoftonline.com/<tenant_id>/oauth2/token

而且我也可以使用不记名令牌通过 /users 端点检索用户列表或获取用户的详细信息.get user"方法的结果返回如下:

And I am able to retrieve the list of users or get a user's details with the /users endpoint using the bearer token too. The result of the "get user" method returns something like this:

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
  "businessPhones": [],
  "displayName": "Renato Oliveira",
  "givenName": "Renato",
  "jobTitle": null,
  "mail": null,
  "mobilePhone": null,
  "officeLocation": null,
  "preferredLanguage": null,
  "surname": "Oliveira",
  "userPrincipalName": "renato.company.com.br#EXT#@renatocompanycom.onmicrosoft.com",
  "id": "<user_id>"
}

当然,这是使用在其上传递 user_id/users 端点:

Of course, this is using the /users endpoint passing the user_id on it:

https://graph.microsoft.com/v1.0/users/<user_id>

但是,我无法获取此用户的联系人.当我向下面的端点发送 GET 请求时

I can't, however, get this users's contacts. When I send a GET request to the endpoint below

https://graph.microsoft.com/v1.0/users/<user_id>/contacts

我收到以下错误:

{
  "error": {
    "code": "OrganizationFromTenantGuidNotFound",
    "message": "The tenant for tenant guid '<my_active_directory_tenant_id>' does not exist.",
    "innerError": {
      "request-id": "<request_id>",
      "date": "2019-03-18T20:43:16"
    }
  }
}

<小时>

为什么会这样?为什么它适用于 /users 但不适用于 /users/{id}/contacts,即使应用程序已激活所有权限,并且默认授予管理员同意目录?


Why is this happening? Why does it work with /users but not with /users/{id}/contacts, even though the application has all permissions activated, and admin consent was granted for the Default Directory?

推荐答案

我没有在我这边重现您的问题.我的步骤如下供您参考.

I didn't reproduce your issue on my side. My steps are as below for your reference.

1.在 Azure 门户上注册一个应用程序并授予它图形权限.

1.Register an Application on Azure portal and grant it graph permission.

2.获取访问令牌.

3.在调用api之前,您需要确认该帐户需要是一个有效的电子邮件地址.我的是 demo101@**.onmicrosoft.com.

3.Before calling the api, you need to confirm that the account needs to be a valid email address. Mine is demo101@**.onmicrosoft.com.

4.调用图形api.

4.Call the graph api.

这篇关于“租户指南的租户不存在"即使用户列在用户端点上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆