msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Get-MgUser not returning EmployeeId
Working with a client we noticed the Get-MgUser does not return the EmployeeId attribute correctly. It always shows blank data in the output :

Using the older AAD PS cmdlets it will properly return the employee ID :

From another thread I tried setting the MgProfile to beta and it actually fixes the issue :

Can we get this fixed without having to load the beta profile? At least having this documented in the Get-MgUser section would be very helpful.
Hi @tomdan-MSFT,
Thanks for identifying and raising this issue, however when I test on my end I get employee Id on both old and latest AAD PS cmdlets.
Please confirm again from your tenant if the requested user has the employee Id property set to a value.
Also confirm the sdk version that you are using by running this command Get-Module -Name Microsoft.Graph -ListAvailable


I have the same issue

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
I have the same issue. EmployeeID appears blank from module microsoft.graph.users 1.10.0. It is not blank when viewed form portal.azure.com console.

I managed to resolve the issue by using Select-mgprofile beta, running the get-MgUser command then swapping back to v1.0.
Hope this helps!
From: Ryan T @.> Sent: Tuesday, October 11, 2022 4:36:29 PM To: microsoftgraph/msgraph-sdk-powershell @.> Cc: lewisevelyn @.>; Comment @.> Subject: Re: [microsoftgraph/msgraph-sdk-powershell] Get-MgUser not returning EmployeeId (Issue #1478)
I have the same issue. EmployeeID appears blank from module microsoft.graph.users 1.10.0. It is not blank when viewed form portal.azure.com console.
— Reply to this email directly, view it on GitHubhttps://github.com/microsoftgraph/msgraph-sdk-powershell/issues/1478#issuecomment-1274895363, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXGU4MKMNYFHKC5PYJUETDWCWCP3ANCNFSM57RKJIKQ. You are receiving this because you commented.Message ID: @.***>
This is still occurring on current modules. Changing to the beta profile allows it to pull the information correctly. Can this be looked into? You shouldn't have to go backwards for this.
Confirmed that this is still not working. Please fix this.
Still not working. Please fix.
I have the same issue. Is there any update on this?
I found a solution after reading Microsoft Graph REST API v1.0 documentation:
$user1 = Get-MgUser -Filter "DisplayName eq 'Alex Wilber'" $user1.EmployeeId $select = "DisplayName, GivenName, PostalCode, Identities, EmployeeId" $user = Get-MgUser -Filter "DisplayName eq 'Adele Vance'" -Property $select $user.EmployeeId 1
According to the documentation, specific properties should be selected explicitly, and looks like EmployeeId is one of them. Interestingly, it won't be retrieved if an asterisk is used: Get-MgUser -Filter "DisplayName eq 'Adele Vance'" -Property * $user2.EmployeeId returns nothing.