Azure AD Graph API – Get User (or DirectoryObject) Extended Properties (C#)

Ok, this blog post will be covering an API that doesn’t have any enhancements planned, but I’m hoping this may prove to be useful to others.

From Microsoft themselves:

We strongly recommend that you use Microsoft Graph instead of Azure AD Graph API to access Azure Active Directory resources. Our development efforts are now concentrated on Microsoft Graph and no further enhancements are planned for Azure AD Graph API. There are a very limited number of scenarios for which Azure AD Graph API might still be appropriate; for more information, see the Microsoft Graph or the Azure AD Graph blog post in the Office Dev Center.

First things first, our clients’ Environment contained Extension Properties that were on-premise. To get these available via Azure AD we had to run the Azure AD Connect Sync to sync Directory extensions made by Microsoft Exchange.

Now on to the code. The trick was to cast my IDirectoryObject to the proper class Microsoft.Azure.ActiveDirectory.GraphClient.User. This enabled me to call the “GetExtendedProperties” method.

This site was helpful as well

From the code below I was able to extract the Key’s required by our application. And that, my friends, is that.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.