-->

Outlook 2007 Add-in Deployment as a DLL

2019-07-19 20:10发布

问题:

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
}

}

回答1:

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.