I have an VSTO Outlook Add-in that sometimes (for some reason that I don't know) is slower than normal at startup so Outlook disables it automatically.
Is there any way to make Outlook restart the Add-in again automatically once it disables it? I guess that once Add-in is disabled, it means that it is not running, so under this situation (once disabled by Outlook), the Add-in cannot restart itself, right?
CodePudding user response:
Correct. Your best option is to make sure your addin does not do much on startup when Outlook is looking. Of course since you are using VSTO, .Net run-time can penalize you by taking its sweet time to start up before a single line of your code is even executed.
CodePudding user response:
When that happens, I noticed that selecting "Do Not Monitor this add-in" in Outlook then puts an entry for the add-in in the "DoNotDisableAddinList" registry sub-key -- which then stops the automatic disabling if the add-in merely loads "slowly".
I'm not sure if creating a manual entry in the registry in that location would also do the trick to permanently stop the auto-disabling -- or whether it would be deleted automatically after a set amount of time (like 30 days). But, I can't see any harm in trying. I will give this a try as well and report back (in about 30 days or so).
For me, the registry entry goes in the following sub-key in the HKEY_CURRENT_USER hive:
SOFTWARE\Microsoft\Office\16.0\Outlook\Resiliency\DoNotDisableAddinList
So for example, if the name of the add-in is listed in SOFTWARE\Microsoft\Office\Outlook\Addins as "MyCompany.MyOutlookAddin", then you would create a DWORD value with that name in the above location, and set its value to "1".
Also, if you are not finding the "Resiliency" subkey folder, note the subtle difference in those two "Outlook" locations in the registry (at first I missed this):
SOFTWARE\Microsoft\Office\16.0\Outlook\Resiliency\DoNotDisableAddinList
versus
SOFTWARE\Microsoft\Office\Outlook\Addins
Also -- if you are still not finding the "Resiliency" folder, then it could be that you have never selected "Do Not Monitor" for an add-in, in which case you can create the folder yourself (manually in RegEdit or via an installer like Inno Setup).
UPDATE
I think I found another clue as to how this works. It looks like Outlook also records the time you clicked "Do Not Monitor this addin" in another "Resiliency" subkey called "NotificationReminderAddinData":
SOFTWARE\Microsoft\Office\16.0\Outlook\Resiliency\NotificationReminderAddinData
On my machine there are two values stored there for the add-in I am developing, the first being a DWORD value that appears to be the Epoch time when I clicked "Do Not Monitor this addin". For my add-in, the value recorded is "1664547917", which for me converts to September 15, 2022, at 10:15am -- and sounds about right.
(And wouldn't you know it -- I just changed the name of my add-in a couple days ago and just re-installed it today, meaning that I could have tested out the 30 day timer today... if I hadn't changed its name... alas.)
The other value has "\dtype" appended to the end of my add-in's name. That is also a DWORD value, but is set to "0". I'm wondering if that perhaps equates to the 30 day option when you click "Do Not Monitor this add in".
But here's the thing -- in my "DoNotDisableAddinList" subkey, there is also listed the "TeamsAddin.Connect" addin... but there is no corresponding entry in the "NotificationReminderAddinData"... which makes me wonder if that is in fact how you permanently prevent auto-disabling! I bet it is. I'll give it a shot and report back.