The following methods are included in the project template code file.
Startup (ThisApplication_Startup)
This method handles the Startup event, which is raised after Outlook is running and all the initialization code in the assembly has been run. It is the last thing to run in the constructor of the class that your code is running in.
Shutdown(ThisApplication_Shutdown)
This method handles the Shutdown event, which is raised when the application domain that your code is loaded in is about to unload. It is the last thing to be called in the class as it unloads.