Tuesday, May 15, 2012

Create your first setup project for Outlook Add-in


Here is the steps which will show you how to create your first outlook add-in and setup project for same Outlook Add-in.

Please follow steps given below to create your first Outlook Add-in which will be installable in your Outlook 2010.


(1) Create new project for Outlook Add-in by navigating
File –> New –> Project –> Visual C# –> Office –> 2010 –> Outlook 2010 Add-in –> Give it any name “MyFirstAddIn” and click OK.

(2) To work with code, just put following line of code in auto generated event “ThisAddIn_Startup”
“MessageBox.Show("hi");”
Add namespace “using System.Windows.Forms;” for above code
After putting this code it will look like following screenshot.

(3) Now, to create Setup project for above Outlook Add-In follow steps given below in same project solution.

(4) Right Click on solution –> Add –> New Project –> Other Project Types –> Setup and Deployment –> Visual Studio Installer –> Setup Project –> Give it any name “MyFirstSetup” and click OK.

(5) Right Click on “MyFirstSetup” –> View –> File System. It will open up with File System area with following options on Left Hand Panel. (1) Application Folder (2) User’s Desktop (3) User’s Program Menu

(6) Right Click on “Application Folder” –> Add –> Project Output and it will open up with following screenshot.

Select your Add-in project and select Primary Output then click on OK.
It will selects all dlls and runtime files needed for this output in Right Hand Side panel. Again, Right Click on “Application Folder” –> Add –> File and it will open with “Add Files” dialog, navigate to your Add-in project’s bin folder then select Debug folder and select “MyFirstAddIn.vsto” & “MyFirstAddIn.dll.manifest” file and click OPEN. Again, you will find this two files were added to Right Hand side panel.

- To add Manufacturer path for this installation Right Click on “Application Folder” –> Properties Window –> Default Location and put value “[AppDataFolder][Manufacturer]\[ProductName]” in Default Lcoation.



(7) Right Click on “MyFirstSetup” –> View –> Registry. It will open up with Registry area with following options on Left Hand Panel shown below in screenshot.


(8) From this pane, Expand HKEY_CURRENT_USER –> Software. Follow the steps given below to add your registry entry.

- Under Software there will be default “[Manufacturer]” key is added, rename it with “Microsoft”
- Right Click on Microsoft –> New –> Key and name key to “Office”
- Right Click on Office –> New –> Key and name key to “Outlook”
- Right Click on Outlook –> New –> Key and name key to “AddIns”
- Right Click on AddIns –> New –> Key and name key to “MyFirstAddIn”.

(9) After creating your Registry key “MyFirstAddIn”, follow steps given below to add your values.

- Right Click on Registry Key MyFirstAddIn –> New –> String Value and name it “Description”, Right Click on Description –> Property Window –> Value –> “My First Outlook Addin”
- Right Click on Registry Key MyFirstAddIn –> New –> String Value and name it “FriendlyName”, Right Click on FriendlyName –> Property Window –> Value –> “MyFirstAddIn”
- Right Click on Registry Key MyFirstAddIn –> New –> DWORD Value and name it “LoadBehavior”, Right Click on LoadBehavior –> Property Window –> Value –> “3”
- Right Click on Registry Key MyFirstAddIn –> New –> String Value and name it “Manifest”, Right Click on Manifest –> Property Window –> Value –> “[TARGETDIR]MyFirstAddIn.vsto|vstolocal”

That’s it for your first setup project of your Outlook Add-in, navigate to your Add-in's bin –> Debug –> Click On “MyFirstSetup” or “Setup” and follow installation step. After installation completed, restart your Outlook and on start it will ask you to Install our Add-in into outlook. Click on Install. After installation, it will prompt you with “hi” Message Box. So, every time you open up your Outlook it will prompt with “hi” Message Box. This way you can put your own code in event start up and create setup for that and after installing it you can achieve your goal.


No comments:

Post a Comment