Microsoft Graph g-raph (giraffe) - the spirit animal of Microsoft Graph

How to fix Graph API returning null properties for Users?

This post was most recently updated on April 28th, 2022.

2 min read.

This article explains a quick fix to a small but annoying issue: Microsoft Graph API SDK persistently returning null values for most properties of your Microsoft.Graph.User objects. The issue might happen when using either the Graph API SDK or just calling the REST API directly. Both options are entirely acceptable, and in both cases, you’re not getting the properties you wanted.

Well, I wasn’t, anyway.


The other day, I was developing a thingie that needed to fetch fields like Department from Azure AD. The hot library for doing stuff like this is Microsoft’s own Graph API – so naturally, I was using it.

But unfortunately, despite my request going through just fine (I mean, “status code 200” and all that stuff), I only got some basic user profile properties back.

What’s up with that?


The first thing that crossed my mind was missing permissions. Perhaps I hadn’t granted some permissions to my app – so I set out to first investigate with Graph Explorer – the fine online web client for issuing queries to Graph API, even in your own tenant – to see if my queries would work properly there.

Graph Explorer also exposes the really useful “Modify Permissions” -tab, that shows which permissions you’ll need to consent to, in order for your query to be run – as shown below.

"Modify Permissions" tab on the Graph Explorer displaying required permissions and letting you to consent to them.
The “Modify Permissions” tab on the Graph Explorer displays required permissions and lets you consent to them.


Long story short, I was missing permissions. Because of course, I was.

Graph Explorer doesn’t show you the permissions your query might need to fetch, it’ll just show you the permissions required to execute the query without getting an error about being unauthorized to execute the query. It doesn’t tell you what permissions you need to successfully get the data you want.

So it was a user error, but I thought it was useful to document the reason why I ran into it.

I had consented to the User.Read, which was enough to get rid of the 403 for both Graph Explorer and my app – but wasn’t enough to return some of the profile properties. I needed to get User.Read.All for some of the properties – I have no idea which ones because I didn’t find the proper documentation quickly and lost interest when it started working + I doubt these stay the same long enough for Microsoft to properly document them either.

A bit unintuitive, but it’s just another thing you need to know. Graph Explorer evaluates the query, not the parameters.

And don’t get me wrong – the Graph Explorer is great, this is just not a feature it has 😁


0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments