{"id":6632,"date":"2022-10-28T11:12:31","date_gmt":"2022-10-28T10:12:31","guid":{"rendered":"https:\/\/rakhesh.com\/?p=6632"},"modified":"2022-10-28T11:14:32","modified_gmt":"2022-10-28T10:14:32","slug":"graph-api-getting-user-initials-and-middlename","status":"publish","type":"post","link":"https:\/\/rakhesh.com\/azure\/graph-api-getting-user-initials-and-middlename\/","title":{"rendered":"Graph API getting user initials and middlename"},"content":{"rendered":"

Yesterday I learnt about the profile<\/code><\/a> resource type.<\/p>\n

Gettting a user’s details via Graph, using the \/me<\/code> or \/users\/{id|UPN}<\/code> endpoints (or via Get-MgUser<\/code>) don’t return details like the Initials or Middle Name. That’s because these return the user<\/a> <\/code>resource type.<\/p>\n

What you need instead, is to retrieve<\/a> the profile<\/code> resource type. That’s got via the \/me\/profile<\/code> or \/users\/{id|UPN}\/profile<\/code> endpoints (or Get-MgUserProfile<\/code>) which returns a much larger trove of information. (Thanks to<\/a>).<\/p>\n

I also learnt that I can do something like \/users\/{id|UPN}\/profile\/names<\/code> just to get the Names info. I didn’t know one could do that with Graph API.<\/p>\n

GET https:\/\/graph.microsoft.com\/beta\/users\/<UPN>\/profile\/names<\/pre>\n

To just get Initials and (say) DisplayName, use the $select<\/code> operator.<\/p>\n

GET https:\/\/graph.microsoft.com\/beta\/users\/<UPN>\/profile\/names?$select=displayName,Initials<\/pre>\n

One learns new things every day!<\/p>\n

As our circle of knowledge expands, so does the circumference of darkness surrounding it. – Albert Einstein<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"

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 … Continue reading Graph API getting user initials and middlename<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[887],"tags":[1016,1015],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/6632"}],"collection":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/comments?post=6632"}],"version-history":[{"count":0,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/6632\/revisions"}],"wp:attachment":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/media?parent=6632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/categories?post=6632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/tags?post=6632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}