如何将相等过滤器应用于用户请求?
How to apply an equality filter to a Users request?
我正在尝试使用 C# 和 GraphServiceClient
调用 MS Graph 用户 API。我正在尝试按 Mail
进行过滤,但无论我尝试哪种格式,它都会因查询无效而被拒绝。我已经尝试了我在互联网上找到的所有示例,但我似乎找不到使用服务客户端按平等过滤用户的示例。
我在 Filter
中尝试了以下方法。
$"eq('Mail', '{email}')"
,
$"equal('Mail', '{email}')"
,
$"equals('Mail', '{email}')"
,
和 $"'Mail' eq '{email}'"
await _graphClient
.Users
.Request()
.Filter(filter)
.GetAsync();
我 find a way to filter users 我的租户是发行人,但我还需要能够搜索受邀用户。
var filter = $"Identities/any(id:id/Issuer eq '{TenantName}' and id/IssuerAssignedId eq '{emailAddress}')";
删除 TenantName
上的相等性检查使其成为无效过滤器。
我这里做错了什么;可能吗?
这是我代码中的过滤器,供您参考:
var response = await graphClient.Users.Request().Filter("mail eq 'test@mail.com'").GetAsync();
第二个选项是直接在URL中传递电子邮件:
https://graph.microsoft.com/v1.0/users/test@mail.com
代码:
var user = await graphClient.Users["test@mail.com"].Request().GetAsync();
我正在尝试使用 C# 和 GraphServiceClient
调用 MS Graph 用户 API。我正在尝试按 Mail
进行过滤,但无论我尝试哪种格式,它都会因查询无效而被拒绝。我已经尝试了我在互联网上找到的所有示例,但我似乎找不到使用服务客户端按平等过滤用户的示例。
我在 Filter
中尝试了以下方法。
$"eq('Mail', '{email}')"
,
$"equal('Mail', '{email}')"
,
$"equals('Mail', '{email}')"
,
和 $"'Mail' eq '{email}'"
await _graphClient
.Users
.Request()
.Filter(filter)
.GetAsync();
我 find a way to filter users 我的租户是发行人,但我还需要能够搜索受邀用户。
var filter = $"Identities/any(id:id/Issuer eq '{TenantName}' and id/IssuerAssignedId eq '{emailAddress}')";
删除 TenantName
上的相等性检查使其成为无效过滤器。
我这里做错了什么;可能吗?
这是我代码中的过滤器,供您参考:
var response = await graphClient.Users.Request().Filter("mail eq 'test@mail.com'").GetAsync();
第二个选项是直接在URL中传递电子邮件:
https://graph.microsoft.com/v1.0/users/test@mail.com
代码:
var user = await graphClient.Users["test@mail.com"].Request().GetAsync();