我想过滤来自"AAA BBB <abc.def@yyy.com> on behalf of XXX YYY <xxx@yyy.com>"
的所有电子邮件。我尝试了以下三个过滤表达式,而不是它们的工作原理。
构成过滤表达式的正确方法是什么?
var outlook = new Outlook.Application();
var nameSpace = outlook.GetNamespace("MAPI");
nameSpace.Logon(null, null, true, true);
var folders = nameSpace.Folders;
Outlook.MAPIFolder folder = GetFolder(folders);
var inbox = GetInbox(folder);
// var filter = "[SenderEmailAddress] = 'xxx@yyy.com'"; // Return no row
// var filter = "[SenderEmailAddress] like '%xxx@yyy.com%'"; // Condition is not valid.
var filter = "[SenderEmailAddress] like '*xxx@yyy.com*'"; // Condition is not valid.
var filtered = inbox.Items.Restrict(filter)