automation - 如何通过 Outlook 自动化获取属于已读回执 (ReportItem) 的 MailItem

标签 automation outlook vsto outlook-addin mailitem

Outlook 将已读回执存储为 ReportItem对象。

是否有可能获得 ID或者属于给定阅读回执的原始消息的一些细节?我已经浏览了 properties of the ReportItem 对象,但我迷路了。

由于已读回执有不同的形式,我不想以编程方式处理回执的正文 - 相反,如果可能的话,我希望从 Outlook 中获取它。

备注 :该解决方案应该至少适用于 Outlook 2003 到新版本。

最佳答案

看起来是ReportItem之间的唯一链接和来源MailItem ConversationIndex ConversationTopic .这是 Outlook 用来将已读回执消息与相关来源链接在一起的方式 MailItem .您只需要filter by the ConversationTopic 然后 use the first 44 chars of the ConversationIndex to identify the original source MailItem .
示例对话索引
源码索引 :01CDC1C35624E2A7BD18CF8C439CA73B62A052922657 收据索引 :01CDC1C35624E2A7BD18CF8C439CA73B62A0529226570000012862您可以使用 Items.Restrict将项目减少到特定的 DASL 过滤器
DASL 搜索:[ConversationTopic] = 'read receipt ConversationTopic here'定位 ReportItem 的父 MailItem

Outlook.MailItem source = FindReadReceiptSourceMessage(ri);
string entryID = source.EntryID;
// ...
public static Outlook.MailItem FindReadReceiptSourceMessage(Outlook.ReportItem readReceipt) 
{
    Outlook.Folder inbox = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox) as Outlook.Folder;
    string sourceIndex = readReceipt.ConversationIndex.Substring(0, 44);
    string topicFilter = string.Format("[ConversationTopic] = '{0}'", readReceipt.ConversationTopic);
    Outlook.Items topicItems = inbox.Items.Restrict(topicFilter);
    return topicItems.OfType<Outlook.MailItem>().Where(c=>c.ConversationIndex.Equals(sourceIndex)).FirstOrDefault();
}

关于automation - 如何通过 Outlook 自动化获取属于已读回执 (ReportItem) 的 MailItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13364815/

相关文章:

python - Perl 的 HTML::Form::ForceValue 在 Python 中等效

ubuntu - ubuntu 中的 Sikuli 自动化

android - 如何自动化游戏应用程序?

html - Outlook 2003 剥离文本装饰 - HTML 电子邮件

c# - 如何只读取 VSTO Outlook MailItem 正文中的新内​​容?

ubuntu - ansible:sudo -iu 用于交互式 shell

deployment - Outlook 加载项保存配置的位置,C#

html - 显示与浏览器不同的简单电子邮件 CSS

Office (Excel 2007) 加载项中的 WPF MVVM 复合应用程序

clickonce - 为 VSTO Outlook 加载项创建 (ClickOnce) 设置