Hi, Should be a simple question. Using C#, all I want to do is just email to the email address associated to the default profile, how do I do this? I have the following code setup:
Outlook.Application oApp = new Outlook.Application();
Outlook._NameSpace oNameSpace = oApp.GetNamespace("MAPI");
Outlook.MAPIFolder oOutboxFolder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox);
oNameSpace.Logon(null, null, false, false);
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMailItem.To = oMailItem.SenderEmailAddress; //this is where it does not work.
oMailItem.Subject = "subject";
oMailItem.Body = "body";
oMailItem.SaveSentMessageFolder = oOutboxFolder;
I thought by using oMailItem.SenderEmailAddress
, this would work. But it doesn't. Can anyone shed some light on this? All I want to do is send it to myself.