New messages are always created in Drafts. If you want to move it to the
desired folder after the message is created in Drafts you can do so.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"cbukeo via OfficeKB.com" u59160@uwe wrote in message
news:a673768e8b499@uwe...
Hello All,
I am developing an Outlook 2007 addin using VisualStudio 2008 and C#. My
goal
is to create an email inside a user created folder.
I successfully create the folder and a message. However, I cannot get the
message placed in the user created folder. Instead it always ends up in
the
default "Drafts" folder. Is there an outlook object model call that can
solve
this problem?
My code looks like this (a bit simplified):
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Folder olFolder = olParentFolder.Folders.Add("AUserFolder",
OlDefaultFolders.OlDefaultFolders.olFolderInbox);
Outlook.MailItem olMail = (Outlook.MailItem)olFolder.Items.Add(OlItemType.
olMailItem);
olMail.Subject = "Message Subject";
olMail.Body = "Message Unformatted Body";
foreach (string fromAddress in fromAddresses)
{
Outlook.Recipient olRecipient = olMail.Recipients.Add(fromAddress);
olRecipient.Type = OlMailRecipientType.olOriginator;
olRecipient.Resolve();
}
foreach (string toAddress in toAddresses)
{
Outlook.Recipient olRecipient = olMail.Recipients.Add(fromAddress);
olRecipient.Type = OlMailRecipientType.olTo;
olRecipient.Resolve();
}
olMail.Close(OlInspectorClose.olSave);
--
Message posted via http://www.officekb.com