msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Get-MgUser not returning EmployeeId

Open tomdan-MSFT opened this issue 3 years ago • 1 comments

Working with a client we noticed the Get-MgUser does not return the EmployeeId attribute correctly. It always shows blank data in the output :

image

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

image

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

image

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.

tomdan-MSFT avatar Aug 25 '22 01:08 tomdan-MSFT

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

Image

Image

timayabi2020 avatar Sep 15 '22 10:09 timayabi2020

I have the same issue

image image

lewisevelyn avatar Oct 06 '22 18:10 lewisevelyn

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.

ghost avatar Oct 10 '22 19:10 ghost

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.

image

ryeguy637 avatar Oct 11 '22 15:10 ryeguy637

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.

[image]https://user-images.githubusercontent.com/37934378/195135930-eddd310c-e9e9-417c-8342-420997418cdc.png

— 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: @.***>

lewisevelyn avatar Oct 11 '22 16:10 lewisevelyn

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.

Mainframe79 avatar Dec 08 '22 00:12 Mainframe79

Confirmed that this is still not working. Please fix this.

worldsdream avatar May 10 '23 08:05 worldsdream

Still not working. Please fix.

toddalbers avatar May 10 '23 20:05 toddalbers

I have the same issue. Is there any update on this?

olaimonas avatar Jul 09 '23 15:07 olaimonas

I found a solution after reading Microsoft Graph REST API v1.0 documentation:

image

$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.

olaimonas avatar Jul 09 '23 16:07 olaimonas