Exchange Web 服务:更复杂的搜索过滤器

发布于 2025-01-01 23:09:05 字数 685 浏览 0 评论 0 原文

在我之前使用 EWS 的项目中,我的搜索条件要简单得多:查找主题中带有“xxx”的电子邮件。

我现在正在将此代码构建到一个更具多功能性的应用程序中;我将监视各种邮箱的各种标准,例如:

查找收件人为“[电子邮件受保护]”,并且主题包含“xxx”并且(正文包含“yyy”或正文包含“zzz”)

但是,使用 SearchFilterCollection,虽然我可以添加多个 SearchFilter,但我不知道如何应用不同的逻辑运算符...每个似乎都有一个逻辑运算符SearchFilterCollection:

SearchFilterCollection sfc = new SearchFilterCollection(LogicalOperator.Or, new SearchFilter.ContainsSubstring(ItemSchema.Subject, "Test"));

我想一个解决方案是找到所需邮件项目的超集,然后在处理邮件时更准确地过滤它们。但我想知道是否有更好的方法在开始时进行过滤,使用 SearchFilters 或任何其他方式?

In a previous project where I used EWS, my search criteria was much simpler: find emails with "xxx" in the Subject.

I'm now building this code into a more multi-purpose application; I will be monitoring various mailboxes for various criteria, for example:

Find all mail items where the recipient is "[email protected]", AND subject contains "xxx" AND (body contains "yyy" OR body contains "zzz")

However, using a SearchFilterCollection, although I can add multiple SearchFilters, I don't see how to apply different logical operators... there seems to be one logical operator per SearchFilterCollection:

SearchFilterCollection sfc = new SearchFilterCollection(LogicalOperator.Or, new SearchFilter.ContainsSubstring(ItemSchema.Subject, "Test"));

I suppose one solution would be to find a superset of the desired mail items, and then filter them more accurately later, when they are being processed. But I was wondering if there is a better way of filtering at the start, using SearchFilters or any other means?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

呆萌少年 2025-01-08 23:09:05

您可以使用 SearchFilter.SearchFilterCollection (LogicalOperator, SearchFilter[]) 构建复杂的搜索过滤器

检查:如何:在 EWS 托管 API 1.0 中使用 SearchFilter 和 SearchFilterCollection 构建复杂搜索

You could build-up your complex Searchfilter using SearchFilter.SearchFilterCollection (LogicalOperator, SearchFilter[])

Check: HOW TO: Build a complex search using SearchFilter and SearchFilterCollection in EWS Managed API 1.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文