471,344 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,344 software developers and data experts.

Save Mapi.Message as MSG file

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 object (which represents an
email)
to my hard drive or a network 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 (converted from VB.NET)
-----------------------------------------

{
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);
// Get Inbox.
oFolder = oSession.Inbox;
// Get Messages collection.
oMessages = oFolder.Messages;
// Get the second email
oMessage = oMessages.Item(2);
}
-------------------------------------------
Your help will be greatly appreciated
Jun 27 '08 #1
3 3487

Hi Nabil, there is not reason to use Redemption (unless your customers
hates the Outlook security msgboxes ;-))

This code did the trick in my outlook add-in

dim objMailItem as Outlook.mailitem
objMailItem.SaveAs (FileName)

You should have a look at http://www.outlookcode.com/

Best regards

Kasper
I'm trying to save an MApi.Message object (which represents an
email)
to my hard drive or a network 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)
Jun 27 '08 #2
Thanks kasper. This code is to run on a server which doesn't have
Outlook installed. instead I only have Microsoft Messaging API and
Collaboration Data Objects on there!

More specifically, it will run as a Windows Service (Previously NT
Service) so any security message will cause an error anyway!

Thanks for your help anyway!
Jun 27 '08 #3
thd
On Mon, 21 Apr 2008 06:06:22 -0700, Nabil wrote:
Thanks kasper. This code is to run on a server which doesn't have
Outlook installed. instead I only have Microsoft Messaging API and
Collaboration Data Objects on there!

More specifically, it will run as a Windows Service (Previously NT
Service) so any security message will cause an error anyway!

Thanks for your help anyway!
AFAIK, you can only get .MSG files using Outlook, or Redemption.

Tom Delany
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Chris | last post: by
1 post views Thread by V.C.Sekhar | last post: by
2 posts views Thread by Larry Eaton | last post: by
1 post views Thread by bobh | last post: by
3 posts views Thread by Nabil | last post: by
1 post views Thread by Nabil | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.