请问,outlook另存为的.msg文件如何读取? 需求如下:将outlook另存为的.msg文件读取到内存中,并导出为pdf文件,请问如何读取这个.msg文件?提供代码最好,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先把下面网址里的内容看下。http://www.fileformat.info/format/outlookmsg/然后用FileStream写读取算法吧。这个还算好,以前写某些程序的打包格式哪才叫惨。得自己猜格式。哈哈 谢谢ls几位,自己搞定了,没这么复杂:1. 安装office07(估计03也可以,未试)2. 引用:using OutLook = Microsoft.Office.Interop.Outlook;(07版本是12.0)3. 示例代码: OutLook.Application olApp = new OutLook.Application(); OutLook.NameSpace olNS = myolApp.GetNamespace("MAPI"); OutLook.MailItem olMail = default(OutLook.MailItem); bool cancelled = false; string sourcePath = "c:\xx.msg"; string targetPath= "c:\xx.doc";//另存为doc文件 olMail = myNamespace.OpenSharedItem(sourcePath); olMail.SaveAs(targetPath, OutLook.OlSaveAsType.olDoc); //指定 save as 的类型 olMail.Close(cancelled); //ref cancelled传进去的时候必须=false olMail = null; //注意此句必须,否则一直不会释放对象,导致msg文件被锁住,以后加载会报错if(!cancelled){ //转换doc到pdf,不再详述} so kind of LZ, just share the answer finaly. thanks 六楼(Mark2Win)OpenSharedItem在outlook2003里是没有的api,只有2007以上有 C#对摄像头编程 顶者有分 (!!!!急!!!~~~~~~~~~~)请问一下数据库命名与水晶报表的问题 关于注册表键的创建时间 如何降低CPU的使用率 动态的往datagirdview中添加数据 有挑战的问题,需要高手解答 int.parse()格式问题 赚了20万 如何编写"插入用户数据"的代码.急等 请问哪里有MSDN2002或MSDN2001下载? vs2008打包部署 怎么做再次安装的时候会提醒安装,修复还是卸载 webservice及系统架构问题
http://www.fileformat.info/format/outlookmsg/然后用FileStream写读取算法吧。这个还算好,以前写某些程序的打包格式哪才叫惨。得自己猜格式。哈哈
2. 引用:using OutLook = Microsoft.Office.Interop.Outlook;(07版本是12.0)
3. 示例代码: OutLook.Application olApp = new OutLook.Application();
OutLook.NameSpace olNS = myolApp.GetNamespace("MAPI");
OutLook.MailItem olMail = default(OutLook.MailItem);
bool cancelled = false;
string sourcePath = "c:\xx.msg";
string targetPath= "c:\xx.doc";//另存为doc文件
olMail = myNamespace.OpenSharedItem(sourcePath);
olMail.SaveAs(targetPath, OutLook.OlSaveAsType.olDoc); //指定 save as 的类型
olMail.Close(cancelled); //ref cancelled传进去的时候必须=false
olMail = null; //注意此句必须,否则一直不会释放对象,导致msg文件被锁住,以后加载会报错if(!cancelled){
//转换doc到pdf,不再详述
}