【发布时间】:2011-06-25 03:07:25
【问题描述】:
我正在为 Outlook 2010 编写一个加载项。有时它需要删除用户当前选择的邮件项目。我正在使用以下代码,效果很好:
Selection selectedMessages = Globals.ThisAddIn.Application.ActiveExplorer().Selection;
// It is possible for a non-mail item to be part of this collection. (One example is when a calendar
// item is in the deleted items folder. Select it and hit this delete button.)
System.Collections.IEnumerator enumerator = selectedMessages.GetEnumerator();
while(enumerator.MoveNext())
{
if (enumerator.Current is MailItem)
{
((MailItem)(enumerator.Current)).Delete();
}
}
我的问题是,当我以这种方式删除邮件时,用户无法使用正常的“撤消”操作。 用户可以转到“已删除邮件”文件夹并将邮件移回收件箱。但是对于习惯于按 Ctrl-Z 或屏幕左上角的小“撤消”箭头的用户来说,这会让人感到困惑。
有什么方法可以使用撤消机制注册此操作,或者可能在邮件上调用 Outlook 的“真正”删除功能,以便自动撤消?
【问题讨论】:
标签: c# outlook pia outlook-2010