Looking for a way to save a .msg file or load a .msg file?



Outlook Object Model (OOM) can do this easily.  Below is a sample:


  howto - save and load a message to a folder.
Sub SaveAndLoadMsgFile()
   Dim ol As Outlook.Application
   Dim olns As Outlook.NameSpace
   Dim oOrigItem As Outlook.MailItem
   Dim oNewItem As Outlook.MailItem
   Set ol = CreateObject("Outlook.Application")
   Set olns = ol.Session
   Set oOrigItem = olns.GetDefaultFolder(olFolderInbox).Items(1)
   oOrigItem.SaveAs "C:\test.msg", olMSG
   Set oOrigItem = Nothing
   Set oNewItem = ol.CreateItemFromTemplate("c:\test.msg")
   oNewItem.Display
End Sub

Comments (2)

  1. mohammed says:

    Did you used webdav before to save message with .msg ext before.

    As above sample not works with web servers throw iis

  2. Mohamedatef says:

    Did you used webdav before to save message with .msg ext before.

    As above sample not works with web servers throw iis

Skip to main content