Return null when group cannot be found by MailNickname instead of throwing NullReferenceException
The same pasted below for convenience:
I'm encountering a null reference exception when looking up a group by MailNickname. Note, the nickname in question does not exist in Active Directory, however, I would expect the library to handle this gracefully and not result in a null reference exception.
It's also worth noting, I am able to use the same code to lookup groups which do exist in Active Directory. I do not control the nicknames my code operate over since they're user input. I would simply like to lookup the group's info, or move on in the case the group does not exist.
// Using nuget package Microsoft.Azure.ActiveDirectory.GraphClient 2.1.1
.Where( g => g.MailNickname == "FakeGroupNickname" )
System.NullReferenceException: Object reference not set to an instance of an object.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Sorry for the late response
Please try the same operation through the new Microsoft Graph .NET client library. If the same issue is still present, please file an issue against the SDK on its GitHub repo here: https://github.com/microsoftgraph/msgraph-sdk-dotnet-core