Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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)


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.
Posted
Updated 11-Apr-13 11:19am
v2
Comments
tumbledDown2earth 11-Apr-13 23:57pm    
You can use AddIn express. Unfortunately it is not a free library too
Thomas Barbare 16-Apr-13 15:31pm    
Hi, I developped a complete software last year for managing Outlook mails(msg). Converting .msg to .html is possible because it was the first purpose of this program.
Tell me if you are still in need I can help you.

There is a library (MSG.Net) available that can help you out
http://www.independentsoft.de/msg/tutorial/readmessage.html
 
Share this answer
 
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[^]
 
Share this answer
 
Comments
tar565 17-Apr-13 16:09pm    
Thanks, as I said above, I tried redemption but it is no use as it is not free.
db7uk 18-Apr-13 5:43am    
Yes you are correct. sorry missed that one.
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900