简体   繁体   English

从.msg文件打开RDOMail for MailItem打开

[英]Getting RDOMail for MailItem opened from .msg file

Is there a way of creating an RDOMail instance for a MailItem corresponding to an Outlook message opened from a .msg file? 有没有一种方法可以为与从.msg文件打开的Outlook消息相对应的MailItem创建RDOMail实例?

My usual approach is to get the CurrentItem from the Inspector , cast it to MailItem , retrieve its EntryID and StoreID values, and finally load it from an RDOSession through the GetMessageFromID method. 我通常的方法是从Inspector获取CurrentItem ,将其RDOSessionMailItem ,检索其EntryIDStoreID值,最后通过GetMessageFromID方法从RDOSession加载它。

However, in the case of messages opened from a .msg , the EntryID property returns null . 但是,对于从.msg打开的消息, EntryID属性返回null Is there another way around this? 还有其他解决方法吗? I assume I could use the GetMessageFromMsgFile method instead, but how do I retrieve the full path of the message from the MailItem ? 我假设可以改用GetMessageFromMsgFile方法,但是如何从MailItem检索消息的完整路径?

PS The solution should ideally work with the Outlook 2003 object model. PS理想情况下,该解决方案应与Outlook 2003对象模型一起使用。

You could do two approaches here... 您可以在此处执行两种方法...

  1. Save the MailItem to disk using _MailItem.SaveAs() . 使用_MailItem.SaveAs()MailItem保存到磁盘。 Then use GetMessageFromMsgFile . 然后使用GetMessageFromMsgFile
  2. Save the MailItem to a Folder (store) to persist it, giving it an EntryID and StoreID . MailItem保存到Folder (存储)以保留它,并为其提供EntryIDStoreID Use MailItem.Save() and MailItem.Move(tempFolder) to persist the MSG to a folder. 使用MailItem.Save()MailItem.Move(tempFolder)将MSG持久保存到文件夹中。 I typically use a hidden folder for this storage swap . 我通常使用一个隐藏文件夹进行此存储交换 You would need to periodically purge this swap folder on startup or at regular intervals ( Outlook has lingering locks, so you better use try/catches ). 您将需要在启动时或定期清除此交换文件夹( Outlook具有持久的锁定,因此最好使用try / catches )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM