是否可以访问 Ribbon_Load 上的当前 MailItem?
我有以下类型的 Outlook 功能区:Microsoft.Outlook.Mail.Compose、Microsoft.Outlook.Mail.Read
我需要根据内容(正文)启用或禁用此功能区中的按钮)的邮件项目,我正在考虑在功能区的加载事件上执行此操作。
我有以下代码,但 ActiveInspector 始终为空。
private void RiverRaftRibbon_Load(object sender, RibbonUIEventArgs e)
{
var application = Globals.ThisAddIn.Application;
var inspector = application.ActiveInspector();
MailItem myMailItem = (MailItem)inspector.CurrentItem;
string projectName;
DateTime? dueDate;
if (Common.ParserHelper.IsRiverRaftEmail(mail.HTMLBody, out projectName, out dueDate))
{
btnAccept.Enabled = true;
}
else
btnAccept.Enabled = false;
}
谢谢你!
I have an Outlook ribbon of the following type: Microsoft.Outlook.Mail.Compose, Microsoft.Outlook.Mail.Read
I need to enable or disable a button from this ribbon, based on the content (body) of the mail item, and I was thinking to do this on the ribbon's Load event.
I have the following code, but the ActiveInspector is always null.
private void RiverRaftRibbon_Load(object sender, RibbonUIEventArgs e)
{
var application = Globals.ThisAddIn.Application;
var inspector = application.ActiveInspector();
MailItem myMailItem = (MailItem)inspector.CurrentItem;
string projectName;
DateTime? dueDate;
if (Common.ParserHelper.IsRiverRaftEmail(mail.HTMLBody, out projectName, out dueDate))
{
btnAccept.Enabled = true;
}
else
btnAccept.Enabled = false;
}
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: