Outlook 2003 Interop - 将.msg文件另存为html。 [英] Outlook 2003 Interop - Save .msg file as html.

查看:137
本文介绍了Outlook 2003 Interop - 将.msg文件另存为html。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部晚上,



我有一个包含10,000 .msg文件的文件夹。我需要将.msg文件转换为.html格式。我需要转换.msg文件中包含的任何附件。



我用C#开发,VS2010和Outlook 2003安装在我的电脑上。此外,该软件仅在内部使用。所以,我的第一个想法是使用Outlook Interop,特别是OpenSharedItem()方法,但我在代码段下面收到了异常。



Evening all,

I have a folder with 10,000 .msg files in it. I need to convert the .msg files to the .html format. I do not need to convert any attachments included in the .msg files.

I am developing in C#, VS2010 and Outlook 2003 is installed on my pc. Also, this software will only be used in-house. So, my first thought was to use the Outlook Interop, specifically the OpenSharedItem() method but I receive the exception below the code segment.

MailItem fld = (MailItem)app.Session.OpenSharedItem(pathToMSGFile);







Unhandled Exception: System.AccessViolationException: Attempted to read or write
  protected memory. This is often an indication that other memory is corrupt.
  at Microsoft.Office.Interop.Outlook._NameSpace.OpenSharedItem(String Path)
  at OutlookTest.Program.Main(String[] args)





在做了一些进一步的研究之后,我似乎无法使用Outlook 2003将.msg文件保存为.htm文件。有没有人设法解决上面的错误?



注意:我已经尝试过Redemption,它可以运行,但是非商业开发者版本,在每个转换文件的顶部放置一个这是一个评估版本消息。 Redemption'的文档规定他们的产品可以在非商业软件中免费使用。是否有可用的免费版本的Redemption不包含此消息?我可以从html文件中删除此消息,但我不确定这是否合法。



After doing some further research, it appears that I cannot save .msg files as .htm files using Outlook 2003. Has anyone managed to get around the error above?

Note : I have tried Redemption and it works but the ''non-commercial'' developer version, puts a ''this is an evaluation version'' message at the top of each converted file. Redemption''s documentation specifies that their product is free to use in non-commercial software. Is there a free version of Redemption available that does not include this message? I could remove this message from the html files but I am not sure if that is legal.

推荐答案

有一个库(MSG.Net)可以帮助你out

http://www.independentsoft.de/msg/tutorial/readmessage.html
There is a library (MSG.Net) available that can help you out
http://www.independentsoft.de/msg/tutorial/readmessage.html


你可以准备好Outlook消息体并从中编写一个html doc。您是否也尝试过Redmeption?



http:// www。 dimastr.com/redemption/home.htm [ ^ ]
You could just ready the outlook message body and write a html doc out of it. Have you also tried Redmeption?

http://www.dimastr.com/redemption/home.htm[^]


MSDN上有很多东西需要阅读:编程Outlook 2003



但是 db7uk 表示你必须写邮件正文在一个文件中它的工作
There is a lot of things to read on MSDN : Programming Outlook 2003

but as db7uk said you have to write the mail body in a file and it''s work


这篇关于Outlook 2003 Interop - 将.msg文件另存为html。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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