Unable to get the user details while using Microsoft Graph API.

Mallesh Jambagi 21 Reputation points
2021-08-09T08:15:06.88+00:00

Initially I was using Http Client and Azure Graph API.But when i migrated to Microsoft Graph API ,I am able to generate only the access Token using Microsoft Graph API and Http Client successfully.I am unable to retrieve the user details using Http Client.Whenever I try to fetch the user details,the HttpClient connection is closing and shutting down for the URL GET https://graph.microsoft.com/v1.0/users/?&$top=500 .What might be the issue?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,447 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. JosephXu-MSFT 531 Reputation points
    2021-08-10T02:26:47.753+00:00

    Hi @Mallesh Jambagi .

    1. You can try to add Microsft graph api permissions User.Read.All in your app at azure app registrations.
      121795-image.png
    2. Type in User at search tab.
      121796-image.png
    3. Select User.Read.All.
      121797-image.png
    4. Then click grant admin constent for ... , we can see the status Granted.
      121738-image.png
    0 comments No comments

  2. Mallesh Jambagi 21 Reputation points
    2021-08-10T03:24:28.343+00:00

    Hi @JosephXu-MSFT
    I have added the above permissions.But still it is not working for HttpClient while using Microsoft Graph API.


  3. Mallesh Jambagi 21 Reputation points
    2021-08-10T05:42:39.967+00:00

    121767-screenshot-2021-08-10-at-111047-am.png

    This is the error i am facing when i try to fetch the Users.

    0 comments No comments