Hi All
I am new to this Outlook development through VSTO and needed a quick
clarification.
I am creating new emails in my app (using VSTO & C#) programatically
and am able to do that but was not sure if this is the best way to do
it:
Here is what I do:
public Outlook.MAPIFolder outBoxfolder;
outBoxfolder =
app.GetNamespace("MAPI").GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderOutbox);
Outlook.MailItem newMailItem =
(Outlook.MailItem)filter.outBoxfolder.Items.Add(Outlook.OlItemType.olMailItem);
newMailItem.Subject = mycopiedItem.Subject + " (Please treat this as
Private)";
newMailItem.To = "aaa.hotmail.com";
newMailItem.CC = string.Empty;
newMailItem.BCC = string.Empty;
The above code works but Please let me know if there is a better way
to create new emails.
Dmitry Streblechenko - 28 Sep 2007 01:45 GMT
There is no better or worse way: it all depends on what you arae trying to
achieve.
Use MAPIFolder.Items.Add if you arae creating gan item in a particular
folder (keep in midnd that Outlook always creates mail items in teh Drafts
fodler - bug) or call Application.CreateItme() if you wnat the new item to
be created in the default folder for the specified item kind.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
> Hi All
>
[quoted text clipped - 20 lines]
> The above code works but Please let me know if there is a better way
> to create new emails.