Parse .msg file

V

Vadivel

Hi All,

I have microsoft outlook .msg file in my local harddisk. i need to get
the from, to, subject values from that file.. is there any way to parse
the .msg file in java or
vb programs...

Thanks in Advance

Regards,
Vadivel
 
G

Guest

Hhi Vadivel. Yes, you can. First, set a reference to the Microsoft Office
Outlook Object Model in the References dialog (depending on your programming
tool) or use late binding. The code is pretty simple:

Dim objApplication As Outlook.Application 'or "As Object" for late binding
'Note: if you are using the Outlook VBA Editor, you don't need to
explicitly declare
'an Outlook object variable; use the global Application object instead

Dim objMailItem As MailItem

Set objApplication = New Outlook.Application
Set objApplicatoin = CreateObject("Outlook.Application") 'for late binding

Set objMailItem =
objApplication.CreateItemFromTemplate("C:\Temp\test.msg")
Debug.Print objMailItem.Subject
Debug.Print objMailItem.To
'etc.
 
D

Dan Mitchell

=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==?=
Hhi Vadivel. Yes, you can. First, set a reference to the Microsoft
Office Outlook Object Model in the References dialog (depending on
your programming tool) or use late binding. The code is pretty
simple:

Note that in Java this stuff is much easier if you're using Microsoft
J++, but I think that died as of the (now unavailable) DevStudio V6. I
could be wrong there.

Both this and Dmitry's suggestion assume that you have Outlook installed
on the PC in question -- if not, then it's worth knowing that a .msg file
is just a standard structured storage file, so you can use IStorage and
friends to pull it apart. If you use (say) DocFile viewer it's pretty
obvious what's going on for the basics like subject etc.

-- dan
 
M

Michael Bauer

Am Wed, 15 Mar 2006 12:54:07 -0800 schrieb Dan Mitchell:

And if anyone doesn´t have the time to do the job on his own, I´ve found a
really great alternative: This site www.priasoft.com offers a library for
developers that can read msg files.

Just spend $25,000.00 (!) and you´re - sorry, it is done.
 
D

Dan Mitchell

Michael Bauer said:
And if anyone doesn´t have the time to do the job on his own, I´ve
found a really great alternative: This site www.priasoft.com offers a
library for developers that can read msg files.

Just spend $25,000.00 (!) and you´re - sorry, it is done.

http://www.priasoft.com/exchangemigration/products_msg_r.asp for the
particular library. Very interesting -- thanks for the pointer, I'm always
surprised when I find out that people have done this sort of thing and
never posted about it to these groups.. :)

-- dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top