我有一个收集电子邮件收件箱,可以从多个系统获取通知。我能够通过主题和进程搜索成功,但希望通过电子邮件地址搜索它被发送到,因为主题正在变化和变化。似乎只按显示名称进行搜索,这是收集箱的名称,但我发送给别名。db@domain.local、otherdb@domain.local、thisdb@domain.local都指向一个收款账户。
我喜欢这份工作
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, "to:'db@domain.local'", new ItemView(10));然后我可以根据收件人地址设置不同的处理。
我尝试设置SearchFilter,但ItemSchema似乎不提供SentTo,只提供DisplayTo。
SearchFilter.ContainsSubstring sentToFilter = new SearchFilter.ContainsSubstring(ItemSchema.DisplayTo, "db@domain.local", ContainmentMode.Substring, ComparisonMode.IgnoreCase);
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sentToFilter, new ItemView(10));下面是我在Query https://msdn.microsoft.com/en-us/library/office/dn579420(v=exchg.150).aspx中找到的搜索选项
发布于 2015-11-04 04:00:47
多亏了@Moo-Juice,我找到了InternetMessageHeaders模式中的EmailMessageSchema
SearchFilter.ContainsSubstring sentToFilter = new SearchFilter.ContainsSubstring(EmailMessageSchema.InternetMessageHeaders, "db@domain.local", ContainmentMode.Substring, ComparisonMode.IgnoreCase);
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sentToFilter, new ItemView(10));发布于 2015-11-04 03:22:49
您正在使用ItemSchema。考虑使用包含ToRecipients的EmailMessageSchema。
https://stackoverflow.com/questions/33507305
复制相似问题