Outlook 2007 加载项部署为 DLL

发布于 2024-10-28 05:44:57 字数 2779 浏览 4 评论 0原文

我开发了第一个 Outlook 加载项,

我可以看到调试加载项会自动打开 Outlook,我注意到的问题是,当我的加载项附加时,Outlook 需要大约 20 秒 才能打开( 作为带有一个按钮的新菜单)。
我认为这可能是由于我正在调试我的项目所致!,
我将加载项发布到本地主机,然后使用单击一次的方式安装它,但加载时仍然挂起
outlookAddIn2.vsto 文件被 Outlook 用作我的自定义加载项,但是当我看到其他加载项时,所有这些加载项都是 dll,而不是 vsto,而且它们不会在启动时挂起 Outlook

应该怎么办?我确实将我的项目部署为 dll,但又不会在启动时冻结我的 Outlook?

先感谢您。

ps:最终该加载项将在我们的内网员工 Outlook 帐户中实施

编辑:

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
}

}

I had my first outlook add-in developed,

I can see that debugging the add-in opens the outlook automatically, the issue i noticed that outlook takes about 20 sec to open when my add-in attached (as new menu with one button).
I thought it might be caused by the fact the im debugging my project!,
I published my add-in to my localhost, and then installed it using the click once thing, but still hangs on load
the outlookAddIn2.vsto file is used by outlook as my custom add-in, but when i saw the other add-ins all of them was dlls not vsto plus they dont hang up the outlook on start

What should I do to deploy my project as dll and yet not to freeze my outlook on startup?

Thank you in advance.

p.s.: eventually the add-in will be implemented in our intranet employees outlook accounts

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
}

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情域 2024-11-04 05:44:57

您可能会遇到“检查发布者证书吊销”瓶颈。它与 Outlook 无关,而是与在没有适当互联网访问的环境中运行的 .net-assemblies 有关。请参阅此条目 在 Add-in Express 论坛中,参考 此讨论。您可以禁用 IE 设置,或尝试验证 Internet 访问。

当我的VMWare开发机器认为它具有网络访问权限,但主机的网络已关闭时,我总是遇到这个问题,例如VM桥接到主机,但主机的网线未插入,或者如果VMWare 来宾是正在运行域控制器的域的一部分(=>网络可用),但该网络无法访问 Internet,也没有适当的证书颁发机构。在这种情况下,启动时间会变慢。如果主机可以访问互联网,则不会出现启动延迟。

Probably you run into the "Check for publishers certificate revocation" bottleneck. It has nothing to do with Outlook, but with .net-assemblies running in an environment without proper internet access. See this entry in the Add-in Express forum, with a reference to this discussion. Either you can disable an IE setting, or try to verify the Internet access.

I are always running myself into this problem when my VMWare development machine thinks it has network access, but the host's network is switched off, e.g. the VM is bridged to the host, but the network cable of the host is not plugged in, or if the VMWare guest is part of a domain with a domain controller running (=> network available), but this network has no Internet access and no proper Certificate Authority. In this case, slow startup time. If the host has Internet access, no startup delay.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文