none
OUTLOOK VSTO on uninstall event RRS feed

  • Question

  • The add-in I am going to develop will create some custom stuff, and I want to run codes to clean up those stuff when users uninstall the add-in.

    what is the best way to handle this?

    The code I am currently using is 

    public class CleanUp : IAddInPostDeploymentAction
    	{
    		void IAddInPostDeploymentAction.Execute(AddInPostDeploymentActionArgs args)
    		{
    			switch (args.InstallationStatus)
    			{
    				case AddInInstallationStatus.Uninstall:
    					{
    						MessageBox.Show("test", "test");
    					}
    					break;
    			}
    
    		}
    	}

    But this code does not fire when I remove the add-in from outlook.

    So what is the most common way that we would expect a user delete the add-in (through control panel, command, delete from outlook), and how do we catch such events?



    • Edited by Frostless Monday, July 16, 2018 11:50 AM make it more clear
    Monday, July 16, 2018 11:44 AM

All replies

  • Hello,

    Looks like you just need to add a custom action which can be run at the uninstallation stage to the add-in installer. Take a look at the following links:

    Deploy an Office solution by using Windows Installer

    Custom Actions


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, July 16, 2018 2:53 PM
  • What about click once? I am planning to use click once to deploy the add-in. Do the click once provide similar functions?
    Monday, July 16, 2018 11:09 PM
  • As a general rule, user settings are not removed (Outlook itself does that). What if the user reinstalls your addin?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, July 18, 2018 1:46 PM
  • As a general rule, user settings are not removed (Outlook itself does that). What if the user reinstalls your addin?


    My add-in will create a custom folder when it is initially installed. And I want to delete this folder when users uninstall my add-in. So this is not user settings. When user reinstall my add-in, the folder will be created again.
    Saturday, July 21, 2018 8:17 AM
  • How do you plan to handle any user content that was placed into the folder when the add-in is uninstalled?
    Saturday, July 21, 2018 10:28 AM
  • What if the user has multiple profiles (I have at least a dozen) pointing to different stores each with your custom folder?

    Your uninstaller cannot and should not start Outlook to remove folders from all (or even one) profiles. What if it is an online profile and the user is prompted for credentials every time? I have seen products that attempt to go through all Outlook profiles in an installer. Tust me, you would not want to use one of these products.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Saturday, July 21, 2018 5:36 PM
  • How do you plan to handle any user content that was placed into the folder when the add-in is uninstalled?
    The custom folder is designed specifically for loading content from external. It is not meant for user to add other things. The user will be informed of this. So I will rely on this for the custom action of uninstaller.
    Sunday, July 22, 2018 11:23 PM
  • How do you plan to handle any user content that was placed into the folder when the add-in is uninstalled?

    The custom folder is designed specifically for loading content from external. It is not meant for user to add other things. The user will be informed of this. So I will rely on this for the custom action of uninstaller.
    • Edited by Frostless Monday, July 23, 2018 12:05 AM
    Sunday, July 22, 2018 11:23 PM
  • So the plan is to hold users accountable for data loss when the add-in is uninstalled.  Do you really think that's a good way to go?
    Monday, July 23, 2018 12:12 AM