“该项目已移动或删除" Outlook.mailItem [英] 'The item is moved or Deleted' Outlook.mailItem
本文介绍了“该项目已移动或删除" Outlook.mailItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我这样创建一个Outlook邮件:
I create an outlook mail like this:
Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
mailItem.Subject = mailSubject;
mailItem.To = "";
mailItem.Attachments.Add(totalPath);
mailItem.Body = mailBody;
mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
mailItem.Display(true);
//Mail is send succesfully?
是否可以检查邮件是否已成功发送或取消?
Is it possible to check if the mail is sent successfully or canceled?
当我执行以下代码时,错误出现项目已移动或删除"
When i execute the following code, the error appears 'the item is moved or deleted'
Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
mailItem.Subject = mailSubject;
mailItem.To = "";
mailItem.CC = "EDI.Orders@trust.com";
mailItem.Attachments.Add(totalPath);
mailItem.Body = mailBody;
mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
mailItem.Display(true);
//Mail is send succesfully?
if (mailItem.Sent)
{
MessageBox.Show("Sended");
}
else
{
MessageBox.Show("canceled");
}
错误出现在mailItem.Sent. 我的问题是mailItem.Sent如何工作?
The error appears at mailItem.Sent. My question is how does the mailItem.Sent work?
推荐答案
mailItem.Sent
属性显示是否已发送电子邮件.
The mailItem.Sent
property shows if the E-Mail has been sent.
此外,您可以附加到mailItem.Write
事件. (但请注意-还会保存并调用它,依此类推)
Additionally you can attach to the mailItem.Write
event. (But take care - will also get called on just saving & so on)
mailItem.Write += mailItem_Write;
void mailItem_Write(ref bool Cancel)
{
//your code...
}
这篇关于“该项目已移动或删除" Outlook.mailItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文