Reenabling a Hard Disabled Addin

We use the code in Listing 10.14 to show an example of hard-disabling an Outlook add-in.

1. Add a breakpoint to the line of code that divides the first number by the second number, as shown in Figure 10.16.

Figure 10.16. Setting a breakpoint in the Startup event handler of an Outlook add-in

2. Press F5 to run the code.

3. When execution of the code stops at the breakpoint, as shown in Figure 10.17, click the Stop Debugging button.

ThiäApplication.vb File System (5ampleAddin5etup)

▼ X

1 :1c 'er - ..cLiix L>am

1 / (ThisApplication Events) | : startup

a i a ra I re &


El public class ThisApplication


Solution 'SampleAddin' (2 projects) B ¿p SampleAddin j B- S^p Outlook

This Application, vb

| My Project ¿1 SampleAddinSetup


] Private Sub ThisApplication Startup(ByVal s

ender As Object,

ByVal e As System.EventArgs) Handles He


Dim first As Integer = 12 Dim second As Integer = 4


Dim DivideByZero As Integer = first / s




End Sub


] Private Sub ThisApplication Shutdown(ByVal

sender As Object.

r ByVal e As Sys

End Sub

1-End class



1 tfl

Figure 10.17. Stopping code execution in the Startup event handler of an Outlook add-in

4. Press F5 to run the code again. This time a dialog box informs you that Outlook has experienced an error and asks whether you want to disable the add-in, as shown in Figure 10.18. In some cases the add-in is automatically disabled.

Figure 10.18. Dialog box where you can disable an add-in

Figure 10.18. Dialog box where you can disable an add-in

5. For this example, click Yes.

6. To reenable the add-in, click About Microsoft Office Outlook from the Help menu.

7. In the About Microsoft Office Outlook dialog box, click Disabled Items.

8. In the Disabled Items dialog box, select the add-in you created. Then click Enable, as shown in Figure 10.19. The add-in will run when you close and then reopen Outlook.

Figure 10.19. Enabling a disabled Outlook add-in

If a VSTO add-in is hard-disabled, any add-in that was loaded by addinloader.dll will also be disabled; in other words, all VSTO add-ins are disabled. This issue is resolved in VSTO 2005 SE because only the particular add-in that caused the problem is disabled. For more information, see Chapter 14.

You can soft-disable an add-in yourself by navigating to the COM Add-in dialog box and deselecting the check box next to the add-in; or you can permanently remove the add-in by selecting it and clicking Remove. Removing the add-in is essentially the same as running Clean from Solution Explorer.

0 0

Post a comment