简体   繁体   中英

How to open a Outlook mail item in a composing state?

How to open a MailItem using Outlook Interop dll.

This is the code I am using:

Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook._MailItem mailItm = (Microsoft.Office.Interop.Outlook._MailItem)app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItm.To = "xxx@xxx.com";
mailItm.CC = "yyy@yyy.com";
mailItm.Subject = "Some Subject";

mailItem.Send() is used to send a mail. But I want to open a mail item in a composed state. How to do that?

You only have to Display the item:

mailItem.Display(false);

(the false here indicates that the Inspector shouldn't be modal)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM