title: Loading Outlook VSTO add-in from the native COM add-in on startup
body: <p>I've been developing the VSTO plugin for Outlook and on some customers' PCs ran into the slow loading issue (which is apparently a chronic disease for all managed office add-ins as CLR loading is counted towards the whole plugin loading time).</p>
  
  <p>I've read about a workaround that there is a possibility to have the VSTO plugin loaded by setting its <code>Connect</code> property to true from a fast-loading Native COM add-in: <a href="https://blogs.msdn.microsoft.com/andreww/2008/04/19/delay-loading-the-clr-in-office-add-ins/" rel="nofollow">https://blogs.msdn.microsoft.com/andreww/2008/04/19/delay-loading-the-clr-in-office-add-ins/</a></p>
  
  <p>I've implemented it, however even after setting the <code>Connect</code> property of VSTO add-in to true from the Native add-in it is still not loaded. I have the following code that is executed at <code>OnStartupComplete</code>:</p>
  
  <pre><code>CComVariant vtItem("VSTOAddInName");
  
  Office::COMAddInsPtr spCOMAddins;
  m_spOutlook-&gt;get_COMAddIns(&amp;spCOMAddins);
  if (spCOMAddins) {
      Office::COMAddInPtr spCOMAddIn;
      if (spCOMAddins-&gt;Item(&amp;vtItem, &amp;spCOMAddIn) == S_OK)
      {
          spCOMAddIn-&gt;put_Connect(VARIANT_TRUE);
          // I see this message!
          MessageBoxW(NULL, L"Connected flag set", L"Native_Addin", MB_OK);
      }
  }
  return S_OK;
  </code></pre>
  
  <p>The m_spOutlook is defined as:</p>
  
  <pre><code>Outlook::_ApplicationPtr m_spOutlook;
  </code></pre>
  
  <p>I see the MessageBox, so I assume that Connect property is set, but the addin still does not load. I've tried to do t with all possible LoadBehavior settings and none of those work. So the question is whether this workaround supposed to work? Maybe I should execute it under a different callback than <code>OnStartupComplete</code>. It is fine for me tho have the plugin loaded few seconds after outlook start, I just need it loaded and not hit the 1 second startup limit.</p>
  
  <p>I would really appreciate your help!</p>
  
  <p>P.S. The load-once delay-loaded VSTO plugin (LoadBehavior=16) is only a partial solution for me as I need the button in the ribbon to be disabled on certain items, so I need the plugin to be really loaded. Also, sometimes the button is disappeared without any notable reasons and it requires end users to do some magic to get it back which is not an option for me.</p>