[英]How to filter Groups by Distribution List Email using Microsoft Graph API?
I'm trying to run a query that pulls back any groups that match the given email. 我正在尝试运行一个查询,该查询将拉回与给定电子邮件匹配的所有组。
This will be ultimately used to expand a DL's members given an email. 给定电子邮件后,这将最终用于扩展DL的成员。
var emailAddress = "test@email.com"
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var group = await graphClient
.Groups
.Request()
.Filter($"mail+eq+{emailAddress}")
.GetAsync();
I expect that the query will run without error on the filter and either return a group with said email or if none are found use the default behavior of the api. 我希望查询在过滤器上运行时不会出现错误,并返回包含上述电子邮件的组,或者如果找不到该组,则使用api的默认行为。
However, it currently breaks on the filter query. 但是,它当前在过滤器查询上中断。
I guess you are getting Invalid filter clause
exception, emailAddress
value in filter expression needs to be enclosed in single quotes like this: 我猜您正在收到
Invalid filter clause
异常, 过滤器表达式中的 emailAddress
值需要用单引号引起来,如下所示:
var groups = await graphClient
.Groups
.Request()
.Filter($"mail+eq+'{emailAddress}'")
.GetAsync();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.