question

DaniSleiman-0148 avatar image
0 Votes"
DaniSleiman-0148 asked Deva-MSFT answered

Getting users list of an organization

I have implemented SPA with Microsoft graph API and able to get access token. When I try to fetch users of my organization I am not able to get those users that I have already added in the Azure portal.

The API URL I am using is:
https://graph.microsoft.com/v1.0/users

In the response, I am only getting one user details with which I have generated the access token but not the other users.

microsoft-graph-users
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

  • Outside of your app, have you tried the above Graph API call in MS Graph Explorer or POSTMAN? Can you get all the users?

0 Votes 0 ·

Yes, I have tried the above API in POSTMAN as well as MS Graph Explorer and getting the same result. A screenshot has been attached for the reference.32725-screen-shot-2020-10-15-at-104506-pm.png


0 Votes 0 ·

I have checked this
I logegd in with the same email id in AzureDevops and in Miscrosoft Graph and I have added user in my organization.
By following the steps in url shared below:
https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/add-organization-users?view=azure-devops&tabs=preview-page

After this I hit api to get all users in an organization api but i got only one with the same email id I have logged in Azure Devops.

As I added user to same organization
33690-screenshot-from-2020-10-20-21-08-07.png



I search more related this I have got this .
https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
But now where I can check these permissions ?For which account?


0 Votes 0 ·

Please give a try with POSTMAN by getting a token from Azure AD and then try the /users endpoint. It may help you.

0 Votes 0 ·

How can I pass the dynamically app ids to allow login using angular MSAL?If I have multiple app ids or client Ids , then how can I get dynamically and get login.

0 Votes 0 ·
Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered
  • Ok, it tells that the API doesn't lists users in the organization.

  • When i tried locally in my test tenant, i can able to get the list of all users.

  • Please check with your administrator to see whether the users are part of same organization or not.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

In case if you want to access guest users then try like this:

 GET https://graph.microsoft.com/v1.0/users?&$filter=userType eq 'Guest'
0 Votes 0 ·
DaniSleiman-0148 avatar image
0 Votes"
DaniSleiman-0148 answered

Hi
I got to know that users list will not appear if account type is microsoft account.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.