Open .msg files - using CreateItemFromTemplate? - with .NET and XP PIA

R

RichW

Hi everyone -

I'm trying to open .msg files using the CreateItemFromTemplate method
in the Office XP PIA. I've managed to find a scant few examples - but
they appear to be using another version of this method because they
reference only one parameter.

The PIA version is sonethimg like this:

CreateItemFromTemplate(string Templatepath, object InFolder)

As in something, I suppose, like this:


public string OpenMSG(string Templatepath)
{
if (!Directory.Exists(Templatepath))
return "Directory: " + Templatepath + " does not exist";

Microsoft.Office.Interop.Outlook.Application oApp =
new Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.NameSpace oNS;
//Microsoft.Office.Interop.Outlook.Application msgItem;
//Microsoft.Office.Interop.Outlook.MAPIFolder Infolder;
object Infolder = null;
object msgItem;

// Initiate a MAPI Session and connect
oNS = oApp.GetNamespace("MAPI");
oNS.Logon("Clouseau","Haddock143",false,true);

msgItem = oApp.CreateItemFromTemplate(Templatepath, Infolder);

// blah, blah, blah...

return "Anybody have any idea what's going on?!?";
}


***********************************
Does anyone have any ideas???

Thanks in advance for the wisdom.

Best,

- Rich
 

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