Resource not found for the segment user - Applicat

2019-08-18 07:35发布

问题:

I am able to authenticate and get an application token to use the Microsoft Graph API. I have set all of the delegated and admin permissions to have access to the users. I have also used the graph explorer to verify what permissions I need: https://developer.microsoft.com/en-us/graph/graph-explorer#

I verified my user GUID (my ID) through Azure AD as well as the Graph Explorer using their https://graph.microsoft.com/v1.0/me/ call while signed in. Given I'm using the application token so I must specify a user (see below).

Here is what I'm passing

GET https://graph.microsoft.com/v1.0/user/{my GUID from Azure AD}
Authorization: bearer {myAccessToken}
Content-Type: application/json

I suspect it's a syntax issue or a permissions issue.

回答1:

The URL should be:

https://graph.microsoft.com/v1.0/users/{GUID}

And you instead of a Content-Type header, you should send a:

Accept: application/json