仅使用 VSTO 和 C# 获取 Outlook 电子邮件中的最新回复文本 [英] Only get the latest reply text in an Outlook Email using VSTO and C#

查看:72
本文介绍了仅使用 VSTO 和 C# 获取 Outlook 电子邮件中的最新回复文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经浏览了许多链接,但似乎没有一个有效.我的问题是,在使用 C# 和 VSTO 编写的 Outlook 插件中,我希望将最新回复电子邮件的文本捕获到线程.

I have gone through many links already but none of them seems to be working. My problem is that in an Outlook Add-In written using C# and VSTO, I am looking to capture the text of the latest Reply email to a thread.

问题是 MailItem 对象上的所有属性(如 Body、HTMLBody 等)都提供了电子邮件的完整文本,包括过去的回复.我希望以某种方式只获取最新的文本.考虑到电子邮件中的多种语言,我需要能够做到这一点.

The problem is that all the properties on a MailItem object such as Body, HTMLBody etc give the entire text of the email including past replies. I am looking to somehow only get the most recent text. And I need to be able to do this considering multiple languages in an email.

这是我尝试过的

  1. 在 MailEditor 上使用书签 - 似乎没有更多带有 Exchange 和 Outlook 的 _MailOriginal 书签
  2. 以某种方式试图推迟 MIME 属性 - 我对选择哪些属性以及如何使用它们来解析最近的文本知之甚少.

推荐答案

即使在理论上,你也不能这样做:想象一个用户在消息的顶部输入(例如见下文"),然后在其中插入/删除各个部分下面的消息正文(我一直这样做).如果字体颜色不同,你很幸运.

You cannot do that even in theory: imagine a user typing at the top of the message (e.g. "see below") and then inserting/deleting various pieces in the message body below (I do that all the time). You are lucky if the font color is different.

您可以尝试将原始消息与新消息进行比较并找出差异,但这需要访问原始消息.您可以查看 PR_IN_REPLY_TO_ID MAPI 属性(DASL 名称 http://schemas.microsoft.com/mapi/proptag/0x1042001F)并尝试在收件箱或已发送邮件文件夹.请注意,在后一种情况下(Sent Items 文件夹),该属性可能在缓存的邮件中不可用,您需要搜索该文件夹的在线版本(在 OOM 中不能这样做,您需要 C++ 中的扩展 MAPI 或Delphi 或任何语言的救赎).

You can try to compare the original with the new and figure out the diff, but that requires access to the original message. You can look at the PR_IN_REPLY_TO_ID MAPI property (DASL name http://schemas.microsoft.com/mapi/proptag/0x1042001F) and try to find the original message either in the Inbox or the Sent Items folder. Note that in the latter case (Sent Items folder) the property might not be available on the cached message, you'd need to search the online version of the folder (cannot do that in OOM, you'd need Extended MAPI in C++ or Delphi or Redemption in any language).

这篇关于仅使用 VSTO 和 C# 获取 Outlook 电子邮件中的最新回复文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆