Thank you both for your kind and thorough responses. My objective is to
deal with the loose MSG file as a MailItem object. I am developing in
VS.NET Enterprise Architect 2003 for OL 2003. Your threads lead me in three
directions:
1. KEN: If I used either Shell.Run, Win32 ShellExecute, or DDE, how do I
programmatically make that into a MailItem so I can feed it into my MailItem
code (exactly as if it were found inside a MapiFolder)? (I see that I might
need to programmatically "Copy To Folder" in order to guarantee that.)
Please point me in the right direction if you would.
2. KEN: Checking into "Extended MAPI" at Microsoft lead me to the MFCMapi
gadget and sourcecode. Inside there, I found that there is a
LoadFromMSG(Filename, IMessage) method, but I run into three problems,
because I am a VB programmer, not a C++ programmer. Problem A is that the
MFCMapi project compiles to an EXE instead of a DLL and therefore cannot be
"referenced" from VB.NET. Problem B is that I could choose a new project to
port the LoadFromMSG() source code into, but I do not know which type of
project to start with. Problem C is that I really don't know how to create
an IMessage so I can call the method.
3. SUE: If I use the CreateItemFromTemplate method on a loose MSG file, I am
finding this intermittent and sometimes gives the error:
"Error writing e-mail Attachment filename (<filename.msg>): Can't open file:
<filename.MSG>. The file may not exist, you may not have permission to open
it, or it may be open in another program. Right-click the folder that
contains the file, and then click Properties to check your permissions for
the folder.; STACK TRACE: at
Microsoft.Office.Interop.Outlook._Application.CreateItemFromTemplate(String
TemplatePath, Object InFolder) at ..."
My question to SUE is, If the file is templated instead of opened, what is
the list of properties that may differ from the original MSG file, if you
can tell me?
I apologize if that is too many directions to go in one thread. (1a, 1b, 1c,
2, 3).
Thanks,
~ Shaun Merrill, Senior Database Architect in Bremerton, WA