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

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

问题描述

我正在尝试与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端点检索用户列表或获取用户的详细信息. 获取用户"方法的结果返回如下内容:

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>"
}

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

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.获取访问令牌.

2.Get the access token.

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.

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

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