【发布时间】:2026-02-22 21:55:01
【问题描述】:
我正在尝试在 Outlook-2010 中创建一个搜索文件夹,代表与特定电子邮件地址有关的所有 MailItems。
即电子邮件地址设置为 SenderEmailAddress 或 Sender 或 Recipients 之一或 ReplyRecipients 之一的 MailItems。
据我所知,我无法使用 Application.AdvancedSearch 方法和 DASL 过滤器执行此操作,因为无法访问 Recipients 或 ReplyRecipients。
我尝试使用 Redemption Searches 对象设置限制:
Set Store = RDSessoin.Stores.DefaultStore
Set Searches = Store.Searches
Set Folder = Store.IPMRootFolder
Addr = "123@example.com" 'the email being searched
SQL = "(SenderEmailAddress LIKE '%" & Addr & "%') OR " & _
"(Recipients LIKE '%" & Addr & "%')"
Set NewSearch = Searches.AddCustom(Addr, strSQL, Folder)
有效,但不包括回复收件人和发件人条件。
当我尝试将它们添加到限制中时
SQL = "(SenderEmailAddress LIKE '%" & Addr & "%') OR " & _
"(Recipients LIKE '%" & Addr & "%') OR " & _
"(ReplyRecipients LIKE '%" & Addr & "%') OR " & _
"(Sender LIKE '%" & Addr & "%')"
出现“未知属性名称”错误。
正确的限制语法是什么?还有其他方法可以创建这样的搜索文件夹吗?
【问题讨论】:
标签: vba email outlook outlook-redemption