简体   繁体   English

如何使用Microsoft Graph API按通讯组列表电子邮件过滤组?

[英]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.

相关问题 如何使用 Microsoft Graph API 获取所有组的用户名? - How to get user names of all groups using Microsoft Graph API? 如何使用 Microsoft Graph API 发送邀请 email - How to sent invitation email using Microsoft Graph API 如何使用 Microsoft Graph API 从包含嵌套组的组中仅获取用户? - How to get only User's from a Group that contains nested Groups using Microsoft Graph API? 使用 Microsoft Graph 客户端 API 发送带有 attachemtns 的 email - Send email with attachemtns using Microsoft Graph Client API "在 c# 中使用 Microsoft Graph API 获取所有电子邮件" - Get all email message using Microsoft Graph API in c# 如何在 C# Web 窗体中使用具有委托权限的 Microsoft Graph API 读取电子邮件附件 - how to read email attachment using microsoft graph api with delegate permissions in C# Web Form 如何撤回使用 microsoft graph api 发送的预定电子邮件? - How to withdraw a scheduled email sent with microsoft graph api? 如何使用Microsoft Graph创建通讯组? - How to create Distribution Group with Microsoft Graph? 如何筛选使用 Microsoft Graph 查询的 Sharepoint 列表项 - How to filter Sharepoint List Items Queried with Microsoft Graph 如何使用 C# 图 API 按主题正文和 HasAttachments 过滤 Email 消息 - How to filter Email Messages by Subject Body & HasAttachments using C# Graph API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM