1

Hi (i'm new to this so you'll need to forgive me),

I'm trying to use Microsoft Graph API to retrieve some user attributes from active directory.

I'm conducting some testing on Microsoft graph explorer but i'm not entirely sure how to retrive a specific attribute called employeeID (which is needed). I've found out how to retrive some of the other basic information i need using the following:

https://graph.microsoft.com/v1.0/me

Which returns:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "id": "6df92a63-2bef-477c-8c84-bf1113d5bd3e",
    "businessPhones": [],
    "displayName": "SmithB",
    "givenName": "bob",
    "jobTitle": null,
    "mail": "example@example.com",
    "mobilePhone": null,
    "officeLocation": null,
    "preferredLanguage": null,
    "surname": "smith",
    "userPrincipalName": "example@example.com"
}

However, i'm at a loss beyond this point. The docs seem to mention something about using $select but it seems to be more for refining a query rather than finding a specific attribute.

I'm sure there is a fairly simple solution and would appreciate if someone could point me in the right direction for how to query a specific attribute.

David
  • 2,412
  • 1
  • 14
  • 22
shenstone
  • 77
  • 3
  • 9
  • Did you ever get this to work? What did it take to get it working? – RHarris Oct 05 '17 at 14:56
  • 1
    The final solution can be found here: https://stackoverflow.com/a/45259741/7626823 Pay close attention to the use of `$select` in the get request. – shenstone Oct 06 '17 at 17:53

2 Answers2

3

I guess this thread is pretty outdated. There is now a standard attribute in Azure AD exposed via Microsoft Graph API called "employeeId" as documented on Official GraphAPI reference doc It is not presented in the default response, but can be retrieved by $select argument like: https://graph.microsoft.com/v1.0/users/{user_id}?$select=givenName,surname,employeeId,etc...

Al Foиce ѫ
  • 4,195
  • 12
  • 39
  • 49
1

If you look at the documented properties exposed on a user, you will find there is no property called EmployeeId.

Now it could be that this property exists as an Open Extension on the user object.

In that case you can read here on how to return the extension properties for the user object.

GET /users/{Id|userPrincipalName}/extensions/{extensionId}

Or you could be using Schema Extensions for the same purpose.

GET https://graph.microsoft.com/beta/schemaExtensions

Either way, if you are certian that EmployeeId exists in your directory, you should know it is NOT a default property that is supported by Microsoft Graph or AAD. Instead it must be some extension that was added to your directory with one of the two extension methods above.

I hope this helps.

Shawn Tabrizi
  • 12,206
  • 1
  • 38
  • 69