在Outlook中,我可以設置新郵件的主題(撰寫新郵件消息時),但是我想預先添加文本。所以我需要先獲得主題,然後設置它。如何在Outlook中訪問撰寫郵件項目的主題
Outlook.Application application = Globals.ThisAddIn.Application;
Outlook.Inspector inspector = application.ActiveInspector();
Outlook.MailItem myMailItem = (Outlook.MailItem)inspector.CurrentItem;
if (myMailItem != null && !string.IsNullOrEmpty(myMailItem.Subject))
{
myMailItem.Subject = "Following up on your order";
}
此代碼適用於答覆,但不適用於新消息,因爲在這種情況下,myMailItem爲空。