我的任务是从具有关联元数据的 XML 文件中编写 Outlook .MSG 文件。我尝试使用 Aspose 库,但所有公开的 MapiMessage 属性都是只读的。使用 Outlook 对象模型,我无法更改创建日期以及我必须有权访问的其他属性。我也尝试过 Rebex 库,但它导出到 EML,并且不支持 RTF。
我的问题是,是否有 Mapi 或任何类型的方法来编写 .MSG 文件并可以访问每个属性?
Aspose now supports creating new msg files. Please check out http://www.aspose.com/documentation/utility-components/aspose.network-for-.net/creatingsaving-outlook-message-msg-files.html for details.
However, updating existing msg files is not supported currently. If you load an msg file using MapiMessage class, the properties will still be readonly.
看看http://www.dimastr.com/redemption/ 不肯定,但听起来它可以做你需要的
尝试在Redemption中使用RDOSession .CreateMessageFromMsgFile 。你会得到RDOMail对象;您需要做的就是设置所有属性并调用RDOMail .Save。
类似的东西
Redemption.RDOSession Session = new RDOSession();
Redemption.RDOMail Msg = Session.CreateMessageFromMsgFile(@"c:\temp\YourMsgFile.msg");
Msg.Sent = true;
Msg.Subject = "test";
Msg.Body = "test body";
Msg.Recipients.AddEx("the user", "user@domain.demo", "SMTP", rdoMailRecipientType.olTo);
Msg.Save();