Connecting Tech Pros Worldwide Forums | Help | Site Map

Save MAPI.Message as File

Nabil
Guest
 
Posts: n/a
#1: Jun 27 '08
Hi,

This is the first time I've posted something on here.


I've looked around the web for hours and failed miserably. Hopefully
someone out there would be able to help.


I'm trying to save an MApi.Message (which represents an email) object
to my hard or a network drive drive as an MSG file but I'm getting
nowhere. I know I
can use Redemption to do this but I'm trying to avoid 3rd party
products (especially ones I have to pay for)

Here's my code

------------------------------------

MAPI.Session oSession = new MAPI.Session();
MAPI.Folder oFolder;
MAPI.Messages oMessages;
MAPI.Message oMessage;
string strEmailAccount = "Exchange_Email_Account";
string strExchangeServerName = "exchange04";


object profile = null;
string strProfile = strExchangeServerName + Constants.vbLf +
strEmailAccount;


oSession.Logon("", , , false, , true, strProfile);


oFolder = oSession.Inbox;


oMessages = oFolder.Messages;


oMessage = oMessages.Item(2);

----------------------------------------------

Your help will be appreciated!

Thanks

Peter Duniho
Guest
 
Posts: n/a
#2: Jun 27 '08

re: Save MAPI.Message as File


On Fri, 18 Apr 2008 01:30:30 -0700, Nabil <nyousfi@gmail.comwrote:
Quote:
[...]
I'm trying to save an MApi.Message (which represents an email) object
to my hard or a network drive drive as an MSG file but I'm getting
nowhere.
Sorry to say, I'm not sure this newsgroup is going to be a great place to
get your answer. If the MAPI.Message object includes some sort of
"Save()" method that automatically writes the file format you're looking
for, then that's obviously the way to go. However, I have to assume that
since you're posting here you've already verified no such method exists (I
certainly don't know myself one way or the other).

I suppose it's possible that the MAPI namespace itself includes some class
with a static method that could do the job, but that seems like more of a
long shot, and in any case again...it seems unlikely that the expertise
for knowing the answer off the top of one's head probably doesn't exist in
this newsgroup.

Barring that, you're probably going to have to figure out the MSG file
format yourself, extract the data from the Message object, and write out
the message file yourself. But again, not much help would exist in this
newsgroup for that.

Basically, your question has practically nothing at all to do with C# (the
nominal topic of this newsgroup), and relatively little to do with .NET
(technically off-topic, but de facto within the scope of the newsgroup).
You really need to find a forum specifically targeted at the interop API
for messaging, or maybe even Office (I realize it's not Office per se, but
the MSG format I think is, and in any case you're much more likely to run
across people with experience in this area in such a forum).

And no, I don't know off-hand where those forums are. But surely they are
out there. :)

Sorry for not being more helpful.

Pete
Nabil
Guest
 
Posts: n/a
#3: Jun 27 '08

re: Save MAPI.Message as File


Thanks a lot for taking the time to reply.

There's no Save() method in Mapi.Message but I will double check the
MAPI namespace. I'll also look for a group that specifically
addresses MAPI.

Cheers

Nabil
thd
Guest
 
Posts: n/a
#4: Jun 27 '08

re: Save MAPI.Message as File


On Mon, 21 Apr 2008 01:15:32 -0700, Nabil wrote:
Quote:
Thanks a lot for taking the time to reply.
>
There's no Save() method in Mapi.Message but I will double check the
MAPI namespace. I'll also look for a group that specifically addresses
MAPI.
>
Cheers
>
Nabil
I recommend microsoft.public.win32.programmer.messaging

Tom Delany
Closed Thread