[英]Outlook addin doesn't show when composer window is launched from from any external application
Like when I promptly open outlook, and click on "New E-Mail", I see my addin loads on New Email window (That's where the addin is supposed to be). 就像我迅速打开Outlook并单击“新电子邮件”时一样,我在“新电子邮件”窗口中看到了我的加载项(这就是加载项所在的位置)。 But when I open a doc in Word/Excel and click File>>Click and Save>>Send Using EMail>>Send as Attachment. 但是,当我在Word / Excel中打开文档并单击文件>>单击并保存>>使用电子邮件发送>>作为附件发送时。 Now it does open outlook "New Email window", but my addin doesn't load in the sidebar. 现在,它确实打开了Outlook“新电子邮件窗口”,但是我的插件未加载到侧栏中。 Similarly, when opening Outlook following any link like "mailto:this@email.com" 同样,在打开Outlook后,请点击“ mailto:this@email.com”之类的任何链接
Any suggestion/pointer as to how to achieve this behaviour? 关于如何实现此行为的任何建议/指标?
Edit: I tried a timer, with an interval of around 14 seconds (just for testing). 编辑:我尝试了一个计时器,间隔约14秒(仅用于测试)。 The timer event does execute but I don't get an inspector which should be MailItem. 计时器事件确实执行,但是我没有得到应为MailItem的检查器。 Here's the code: 这是代码:
private void OnTimedEvent(object sender, ElapsedEventArgs e)
{
diagnosticLog.Debug("In OnTimed Event!");
InspectorWrapper wrapper;
foreach (Outlook.Inspector item in Application.Inspectors)
{
diagnosticLog.Debug("In OutlookInspector Loop: " + item.ToString());
if (item is Outlook.MailItem)
{
diagnosticLog.Debug("Inspector is a MialItem: " + item.ToString());
diagnosticLog.Debug("In OnTimed Event!");
if (!inspectorWrappersValue.TryGetValue(item, out wrapper))
{
inspectorWrappersValue.Add(item, new InspectorWrapper(item));
diagnosticLog.Debug("new Inspector Added");
}
}
}
}
This line: 这行:
foreach (Outlook.Inspector item in Application.Inspectors)
does get one inspector but it's never an Outlook.MailItem, hence I can't access the inspector where I should add my addin. 确实有一个检查器,但是它从来都不是Outlook.MailItem,因此我无法访问应该在其中添加插件的检查器。
inspectorWrappersValue is a dictionary and it's in the constructor of InspectorWrapper that I initialize my Addin UI. inspectorWrappersValue是一本字典,它在InspectorWrapper的构造函数中初始化我的Addin UI。
inspectorWrappersValue.Add(item, new InspectorWrapper(item));
This inspector is being opened by Excel (sending attachment) Excel正在打开此检查器(发送附件)
How/when do you add your own UI? 您如何/何时添加自己的UI? Keep in mind that Inspectors.NewInspector event does not fire if the inspector is being opened using Simple MAPI or a mailto link. 请记住,如果使用简单MAPI或mailto链接打开检查器,则不会触发Inspectors.NewInspector事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.