![]() |
Enterprise Systems »
Office Development »
Outlook
Intermediate
Walkthrough - Automatic Update Process for Outlook Add-in SolutionsBy Sanjeev ThazhathaveetilExplains how revisions to an Outlook Add-in solution can be made available on Client Computers seamlessly. |
C#2.0.NET2.0, Win2003, WinForms, VS2005, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
This article answers the question often asked about Outlook Add-In plug-in: Once an Outlook Add-In solution is deployed on the client computer, how can any future revisions to the solution automatically be made available to the client computer seamlessly? This article attempts to provide end-to-end steps on how the Update Process for Outlook Add-Ins Solutions needs to be handled once the application is deployed on the end-user machine.
Normally an application is deployed on the client computer in two ways: One is using the "setup" (using either Microsoft's or third party setup projects) or using the "publish" or more popularly known as "Click-once".
As you can see, there are definite reasons why you need to choose one over the other. Click-once is appealing as this method can be used to publish the application and the updates can be made automatically at the end user. But using this method, an application that requires registry entries cannot be deployed. The traditional method can be used to make registry entries but the automatic updates are difficult unless the auto-updater component is custom developed.
The method explained here uses a combination of both the methods to achieve registry updates during the installation and also to push the updates seamlessly to the end user.
Before we begin, Visual Studio 2005 Tools for Office (VSTO) needs to be installed to create custom add-ins for Outlook in Visual Studio 2005. This article does not address the pre-requisites to develop the Outlook Add-In.

ThisApplication_Startup event procedure. Refer to the attached sample application for details.
// Get the Outlook menu bar.
_menuBar = this.ActiveExplorer().CommandBars.ActiveMenuBar;
// Get the index of the Help menu on the Outlook menu bar.
_helpMenuIndex = _menuBar.Controls[_MENU_BEFORE].Index;
// Add the top-level menu right before the Help menu.
_topMenu =
(Office.CommandBarPopup)_menuBar.Controls.Add(
Office.MsoControlType.msoontrolPopup,
Type.Missing,
Type.Missing,
_helpMenuIndex,
true);
// Set the Caption from App.Config
_topMenu.Caption =
System.Configuration.ConfigurationManager.AppSettings
["TopMenuCaption"];
// Make the new Menu Item visible
_topMenu.Visible = true;
key="MenuBeforeLocation" value="Help" />
key="TopMenuCaption" value="Demo" />
Use the Publish Wizard under Properties to deploy the solution files to a location on a Server that would enable automatic updates to the application on the client computer. This follows the manifest approach that gives more flexibility in maintaining and updating the application without touching the registry again.


You may have noticed that when the Add-in project TestOutlookAddin was created in VS2005, the automatically created setup project TestOutlookAddinSetup contains the Primary output from TestOutlookAddin. Thus the necessary published information like location and version number are available when you rebuild TestOutlookAddinSetup and subsequently in the Windows Installer (.msi) file that will be distributed to your Clients.
Once your Outlook Add-In application is published onto a centralized location, it is time to build the Setup project and distribute it to your Clients as a Windows Installer (.MSI) file. You will now modify the Setup project to check for basic prerequisites.

In this article, we check only two basic prerequisites namely, Visual Studio 2005 Tools for Office Runtime and the Office primary interop assemblies.
{D2AC2FF1-6F93-40D1-8C0F-0E135956A2DA} into the ComponentId property and change the value of Property to CHECK_VSTO_RUNTIME.

Condition1) and rename it to Display VSTO Runtime Message. CHECK_VSTO_RUNTIME and leave the InstallURL property blank. Component1 and rename the search condition to Outlook 2003 Primary Interop Assemblies. {14D3E42A-A318-4D77-9895-A7EE585EFC3B} into the ComponentId property and change the value of Property to CHECK_OUTLOOK2003_PIA.

Condition1) and rename it to Display PIA message. CHECK_OUTLOOK2003_PIA and leave the InstallURL property blank. 
The attached sample application adds a new menu item to Outlook just before the HELP menu. If the installation was successful, the next time Outlook is opened, you should see the new Menu item Demo on the top.

Now that your application has been deployed on your client computer, changes that you make to your solution on the development server should be automatically made available on the Client computer. VSTO uses a concept similar to the ClickOnce to achieve this. In the attached sample application we shall change the caption of the Menu item in the app.config.
Important: Do not change the location of the Publish at this stage. The local application manifest file on the Client computer contains the published Location and version information that would enable the automatic updating process. If the location needs to be changed for some reason, you will have to distribute the Windows Installer file to your clients for re-installation.
Close and re-open the Outlook application on the client computer to see the impact of the new changes to the Add-In application. The new Menu item on the top would have the revised text DemoRevision instead of Demo.
Note: You did not rebuild or re-install your setup application TestOutlookAddinSetup this time.

The following events take place when Outlook is re-opened:
This article demonstrates that once the Outlook Add-In project is deployed on the client computer using the Microsoft Installer (.msi) file created in the setup project of VS2005, further updates to the application can be automatically made available on the Client Computer by using the Publish option of the Add-In project in VS2005. As long as the path to the local application manifest is the same, no further changes in the registry entries are needed for this Add-in. The Publish option will accommodate all updates from here.
Solutions to some of the common issues encountered during Outlook Add-In development and deployment can be found here.
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 28 Nov 2006 Editor: Deeksha Shenoy |
Copyright 2006 by Sanjeev Thazhathaveetil Everything else Copyright © CodeProject, 1999-2010 Web20 | Advertise on the Code Project |