I'm trying to make a call to the MS Graph Users API using C# and the GraphServiceClient
. I'm trying to filter by Mail
but no matter what format I try, it gets rejected due to an invalid query. I've tried all the examples I've found on the interwebs but I can't seem to find one that uses the service client to filter users by equality.
I've tried the following in Filter
.
$"eq('Mail', '{email}')"
,
$"equal('Mail', '{email}')"
,
$"equals('Mail', '{email}')"
,
and $"'Mail' eq '{email}'"
await _graphClient
.Users
.Request()
.Filter(filter)
.GetAsync();
I did find a way to filter users where my tenant is the issuer but I need to be able to also search for invited users as well.
var filter = $"Identities/any(id:id/Issuer eq '{TenantName}' and id/IssuerAssignedId eq '{emailAddress}')";
Removing the equality check on the TenantName
makes it an invalid filter.
What am I doing wrong here; is it possible?