简体   繁体   中英

Trying to get Contacts for an Office 365 account using Microsoft Graph API

I am trying to retrieve a list of contacts for an Office 365 account using the Microsoft Graph API. When I sign in using a hotmail account, everything works. However, if I use an Office 365 account I get the following response error after calling " https://graph.microsoft.com/beta/me/contacts "

{
  "error": {
    "code": "ErrorInvalidUser",
    "message": "The requested user 'xxxxxx@xxxxxxxx.com' is invalid.",
    "innerError": {
      "request-id": "f03da31a-a0d0-4095-9423-8992560c9b26",
      "date": "2017-08-09T20:37:16"
    }
  }
}

I have tried searching for the error on Google but I am unable to find any information that will tell me why Office 365 accounts don't work. Any help would be greatly appreciated.

It looks your 'xxxxxx@xxxxxxxx.com' is used with both a "Work or school account" and a "Personal account". You need to sign in with your Office 365/"Work or school account" to access its mail or contacts. The failed request was made with a token issued for a Personal account that uses the same email address as its identifier as your Office 365 account. When signing in to our test app ( https://developer.microsoft.com/en-us/graph/graph-explorer ) you would be asked which account to want to use. The /beta/me/contacts request should work if you choose "Work or school account", but not when you choose "Personal account" (for that email address).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM