Reputation: 87
I've asked my IT Admin to add an attribute called EmployeeId
in the form of a directory extension to azure active directory which syncs with our onsite AD. I'm trying to retrieve this value for a given user when they sign into my android app.
I've followed this guide which has allowed me to retrieve data from the URL graph.microsoft.com
with the currently logged in user i.e. givenname, surname etc.
The issue is that when I run the get request for schema extensions (https://graph.microsoft.com/beta/schemaExtensions
) to try to retrieve the value of EmployeeId
it just returns some metadata about the attribute, not the attribute it'self:
{
"id": "exti1rcdc4h_Employee",
"description": "Baker is testing extension",
"targetTypes": [
"user"
],
"status": "Available",
"owner": "XXXXXXXXXXXXXXXXXX",
"properties": [
{
"name": "EmployeeId",
"type": "Integer"
}
]
}
After doing some research I've found that i can use this graph explorer to easily retrieve the value (by using the get request https://graph.windows.net/mydomain.com/users/[email protected]
).
The issue is however that the URL graph.explorer.net
doesn't seem to be compatible with the guide mentioned above.
Is there a better way to approach this issue?
--EDIT--
Just to clarify I was only able to retrive the value for extension_980f32feca7d475f9e1b90a410dbee63_employeeID
successfully using the Azure AD Graph explorer the value is not returned when i access the /users endpoint on Microsoft graph explorer
Data returned for each user in GET https://graph.microsoft.com/v1.0/users
request:
"id": "d0be2ebd-0c7b-4c10-aebe-9db4c90a9594",
"businessPhones": [],
"displayName": "username",
"givenName": "Jhon",
"jobTitle": null,
"mail": "[email protected]",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": "Smith",
"userPrincipalName": "[email protected]"
Upvotes: 2
Views: 6672
Reputation: 5838
Yes this is possible. You should be able to run a couple of different queries like:
GET https://graph.microsoft.com/v1.0/users?$filter=extension_980f32feca7d475f9e1b90a410dbee63_employeeID eq 'S09655'
GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,extension_980f32feca7d475f9e1b90a410dbee63_employeeID
Additionally (in the backlog, but actively in progress) we are working to expose on-premises employeeId
natively as a first-class property on the user
entity in Microsoft Graph. I don't have an ETA for this yet though.
Hope this helps,
Upvotes: 1
Reputation: 33114
You're confusion here stems from there being two different Graph APIs at the moment; Microsoft Graph API and Azure Active Directory Graph API.
Prior to Microsoft Graph rolling out there were dozens of APIs, published separately be each product group. Microsoft Graph API was created to coalesce these into a single endpoint. Obviously this is a non-trivial effort so Microsoft Graph has been absorbing APIs over the past few years. One of these absorbed APIs was the Azure Active Directory Graph API.
The API you're looking for is the Microsoft Graph API. In particular I you're looking for these Schema Extensions.
As for accessing the API from Android, you'll most likely want to use the Microsoft Graph SDK for Android. There are also a handful of Android Samples available.
Upvotes: 3