Yesterday I learnt about the profile
resource type.
Gettting a user’s details via Graph, using the /me
or /users/{id|UPN}
endpoints (or via Get-MgUser
) don’t return details like the Initials or Middle Name. That’s because these return the user
resource type.
What you need instead, is to retrieve the profile
resource type. That’s got via the /me/profile
or /users/{id|UPN}/profile
endpoints (or Get-MgUserProfile
) which returns a much larger trove of information. (Thanks to).
I also learnt that I can do something like /users/{id|UPN}/profile/names
just to get the Names info. I didn’t know one could do that with Graph API.
1 |
GET https://graph.microsoft.com/beta/users/<UPN>/profile/names |
To just get Initials and (say) DisplayName, use the $select
operator.
1 |
GET https://graph.microsoft.com/beta/users/<UPN>/profile/names?$select=displayName,Initials |
One learns new things every day!
As our circle of knowledge expands, so does the circumference of darkness surrounding it. – Albert Einstein