Jashvita
Jashvita

Reputation: 661

How to access Employee Id from Azure AD using Microsoft graph

At first I want to mentioned I did search for the answer but I did not get the concrete answer. So here I am asking again.

I am using ASP.NET MVC project and using Microsoft graph to get information from Azure AD. I am trying to get EmployeeId along with DisplayName. For the scope I am using user.readbasic.all.

With below query I am getting DiplayName for all the users but for EmployeeID I am getting null. Except for myself.

https://graph.microsoft.com/v1.0/users?$select=DisplayName,EmployeeId

When I use "me" then again get the EmployeeID.

https://graph.microsoft.com/v1.0/me?$select=DisplayName,EmployeeId

So using the user.readbasic.all I do get employee id but for myself but why not for others

Upvotes: 1

Views: 3560

Answers (1)

RahulKumarShaw
RahulKumarShaw

Reputation: 4610

This is due to for others Employee ID has not been set.

Example: Employee ID has not been set for a user ,so it is showing null.

enter image description here enter image description here

Let me Set an employee ID for a user.

enter image description here

Now I am testing for with same API I am getting my EmployeeID value.

enter image description here

In below Picture you can see as I have set EID for Rahul Only and for others it is showing null.

enter image description here

Upvotes: 1

Related Questions