我开发了第一个 Outlook 插件,
我可以看到调试加载项会自动打开 Outlook,我注意到 Outlook 所涉及的问题20 sec当我的加载项附加时打开(作为一键式新菜单).
我认为这可能是由于我正在调试我的项目造成的!,
我将加载项发布到本地主机,然后使用单击一次的方式安装它,但加载时仍然挂起
the OutlookAddIn2.vsto文件被 Outlook 用作我的自定义加载项,但是当我看到其他加载项时,它们都是 dll,而不是 vsto,而且它们不会在启动时挂起 Outlook
我应该怎么做才能将我的项目部署为 dll,而又不会在启动时冻结我的 Outlook?
先感谢您。
PS:最终该插件将在我们的内网员工 Outlook 帐户中实施
EDIT:
namespace OutlookAddIn2
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
MyToolBar();
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
Office.CommandBar mainMenuBar;
Office.CommandBarPopup oldMenuBar;
Office.CommandBarPopup myMenuBar;
Office.CommandBarButton myButton;
private void MyToolBar()
{
try
{
mainMenuBar = this.Application.ActiveExplorer().CommandBars.ActiveMenuBar;
oldMenuBar = (Office.CommandBarPopup)this.Application.ActiveExplorer().CommandBars.ActiveMenuBar.FindControl
(
Office.MsoControlType.msoControlPopup, missing, "Katakit", true,true
);
if (oldMenuBar != null)
oldMenuBar.Delete(true);
myMenuBar = (Office.CommandBarPopup)mainMenuBar.Controls.Add(
Office.MsoControlType.msoControlPopup,
missing, missing, missing, false);
if (myMenuBar != null)
{
// Add a button to the new toolbar.
myMenuBar.Caption = "Katakit";
myMenuBar.Visible = true;
myMenuBar.Tag = "Katakit";
myButton = (Office.CommandBarButton)myMenuBar.Controls.Add
(Office.MsoControlType.msoControlButton, missing, missing, missing, true);
myButton.Caption = "Pending Summary 2";
myButton.FaceId = 500;
myButton.Tag = "btnPendingSummary";
myButton.Visible = true;
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error: " + ex.Message.ToString()
, "Error Message");
}
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}