Automating Outlook .msg form works but email not sent immediately

G

GregCost

The automation code only loads and makes visible an untitled.msg form
(separate from my project), the main form of Outlook is not loaded. In the
..msg form I can load the contents of the Clipboard, change it, add text, etc.
Clicking the Send Key from the Outlook .msg toolbar works except the message
queues until the next time I’m in Outlook’s main form and I hit the
“SEND/RECEIVE†key. Is there an option in Outlook that sends a .msg when
the send key is clicked from the .msg form?

Why do it this way? … you might ask. For a couple of reasons:

1.I do not have to re-invent the wheel “so to speak†make available all of
the necessary fields, options, addressee and address lists etc. inside my
project.

2.I do not have to worry about cleanup. The native send closes the outlook
..msg object

3.Everything the user needs is there in a format that they are familiar and
comfortable using.

4. I use vs2003 and I had many problems pasting the contents of the
clipboard when it was mixed between Text, Graphics and HTML, etc. I
understand this process has been simplified in VS2005 which I am not ready to
purchase

Any help GREATLY appreciated!

Dim olApp As Outlook.Application
Dim olmailitem As Object Dim olNs As Outlook.NameSpace
Dim olMail As Outlook.MailItem

Try
olApp = CreateObject("Outlook.Application")
olNs = olApp.GetNamespace("MAPI")
olNs.Logon()
olMail = olApp.CreateItem(olmailitem)
olMail.Display()
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("^v")
System.Threading.Thread.Sleep(50)

Catch ex As COMException
MessageBox.Show("Error accessing Word document.")
End Try
 
E

eriq.vanbibber

MSG Files:

Priasoft has several MSG related products. http://www.priasoft.com

In particular, they have a MSG file parsing library that gives
developers access to all the properties of a .msg file, html body,
recipients, attachments..., without outlook.

They also have an export library that works with the MSG library for
exporting msg files to other formats, like PDF, TIF, and HTML.

A command line tool exists too that converts MSG files to XML files:
http://www.priasoft.com/downloads/msg/InstallMSG2XML.exe

For PST files, they have a couple of command line tools that allow
extraction of messages to MSG, again without requiring outlook, and it
supports both ANSI and UNICODE pst files. There is also the reverse, a
MSG to PST utility.
http://www.priasoft.com/downloads/msg/InstallMSG2PST.exe
http://www.priasoft.com/downloads/msg/PST2MSG.exe

They also have a viewer product that looks very similar to outlook 2003
with regards to the User Interface. The viewer can view, search, print,
and export msg files.

Lastly, they just release a free ViewOnly viewer here:
http://www.priasoft.com/msgview.exe


Regards,
the MSG Guru, Eriq VanBibber
 
G

GregCost

Eriq, Thank you for the information - I will certainly look at priasoft, but
for this application I'm look for a native based .NET VB solution
 

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