An exception is thrown when a user's manager is requested, and is null
ryanshripat opened this issue ยท 8 comments
When attempting to access the user's manager through the interface by clicking on the "Get my manager" link on the home page, an exception with the following message is thrown:
Resource 'manager' does not exist or one of its queried reference-property objects are not present.
The following is noted via a comment in the code in UsersController.cs/GetMyManager()
:
// Known issue: Throws exception if manager is null, with message "Resource 'manager' does not exist or one of its queried reference-property objects are not present."
This issue is created with the intent to both confirm from my own experience that it does exist (and indeed, only occurs if the user has no manager specified), and to formalize its existence through the Issues log.
Thanks for reporting this. The behavior you're seeing is by design, as per the product team.
I know I am commenting on an older post, but IMHO "by design" is not a satisfactory answer...
I just spent some time trying to "fix" a non issue, since the API should return null/empty response but returns this obscure error instead.
Please take back to the product team to reconsider and return a valid response with an empty value.
I fully agree with @shaipetel on this one. Return null at least instead of an exception. The latency and load on apps are bad enough without the need to add error handling for something that should be null. Seriously....."by design" is such a cop out answer!
What is even more annoying is that the initial user returned will have manager as null, even if they have a manager, as expand does nothing.
So to fetch manager I have to run a separate query on every single user.
If you have to work with 300'000 plus profiles the performance to query for the manager on every single user you might as well not do it because it takes hours.
The expand should at least return the managers UPN on the property, but instead we are forced to over query the graph client.
@jamescro I take it this issue is not going to get opened again? The fact that it took 4 months to respond to the original issue is rather shocking as well.
@mjohl I no longer work for Microsoft, so I'm no longer involved with maintaining this sample. The sample in this repo is intended only to demonstrate how the service works. This repo isn't the best place to get the product team's attention. You might get more traction on StackOverflow.
(I don't disagree with you, by the way.)
@jamescro Thank you for the info. I will put it on StackOverflow and maybe / hopefully get some traction there.
@mjohl I know it's been a long time since then but did you get any answer for this ?
@thebaud2u see my response in the linked issue #46.