我正在创建一个Outlook 2010插件,并在我的功能区中添加了一个idMso="contextMenuMailItem"的上下文菜单。当我单击时,我想删除一个类别,但是在单击事件处理程序中,当我将ctl.Context转换为MailItem时,它始终为null。
public bool btnRemoveCategory_IsVisible(Office.IRibbonControl ctl)
{
MailItem item = ctl.Context as MailItem; //Always null
if (item != null)
return (item != null && HasMyCategory(item));
else
return false;
}
有人知道这里到底发生了什么吗?谢谢!