Reputation: 7117
I am looking for a microsoft-graph api
which gives information about user role(is the user administrator?
).
I have user https://graph.microsoft.com/User.Read.All
.
It gives following information
{
"businessPhones": [
"+1 425 555 0109"
],
"displayName": "Adele Vance",
"givenName": "Adele",
"jobTitle": "Retail Manager",
"mail": "[email protected]",
"mobilePhone": null,
"officeLocation": "18/2111",
"preferredLanguage": "en-US",
"surname": "Vance",
"userPrincipalName": "[email protected]",
"id": "cccccccc-cccc-aaaa-bbbb-dddddddddddd"
}
Update 1:
Can a single API return an organization's name, it's users with assigned role and access to a particular app/add-in?
If not what are the APIs to get the above information?
How can I determine a user belongs to a work/school account([email protected]
) or belongs to a personal account([email protected]
)?
Upvotes: 0
Views: 162
Reputation: 16448
Use GET https://graph.microsoft.com/v1.0/users/user id/memberOf
to get groups and directory roles that the user is a direct member of.
If the account is a general user, there won't be a directoryRole in the result.
If the account has any directoryRole, it will be shown in the result.
UPDATE:
Use GET https://graph.microsoft.com/v1.0/organization
to get company/domain information. You can find "verifiedDomains" in the response.
The format of IDs of work account and personal account are different.
Example:
Work account: "id": "3df5295a-e4b1-46fe-8969-e715ccd11057"
Personal account: "id": "5d9ee9b4b7ad3bfe"
Upvotes: 1