Showing posts with label outlook. Show all posts
Showing posts with label outlook. Show all posts

Tuesday, 20 January 2009

Fixing corrupted Add-in in Office 2003 / 2007



After building your Add-In in Office 2003 you could end in a very uncomfortable situation. Basically Add-ins in Office 2003 contain plenty of bugs. These bugs are accepted by Microsoft by they don’t provide any help, because of that if you try to search for help on the Internet you could end with nothing.

I found myself in this situation after doing a piece of software that uses add-in’s to work. I felt quite frustrated so I decided to find out the answer of this problem by scanning the registry, add-ins, changing permissions etc.

The conclusion of these Add-In bugs is not easy, just because you have many fixes, some of them will work for you, and some of them will be useless.

I am going to list a few solutions from this problem, from of them come from Microsoft and another from my own research, so if something happened in your system you will be the person responsible of it.

1- The Add-In doesn’t load when you are debugging with Visual Studio 2005 or Visual Studio 2008:

Well, first of all, if you have this problem it could be caused by a built problem. That means you don’t need to install the add-in again, in fact don’t do it or you will be in more trouble. The only thing you need to do is go to your Visual Studio instance, go to deployment project and right click on it. Now select “Rebuild” and rebuild the application, no just once, do it three times, believe me or not that makes a difference. Now try again.

2- The Add-In and any Add-in don’t load when you are debugging with Visual Studio 2005 or Visual Studio 2008:

This problem comes when your Add-in’s have been disconnected from any of your Office Applications to do that read the point (4)

3- The Add-in’s don’t load when I open an office application.

This problem comes when your Add-in’s have been disconnected from any of your Office Applications to do that read the point (4) or your registry is corrupted.

4- The Add-in’s show an error when it runs the application.

To solve this problem we are going to have different approaches:

• LoadBehaviour Issue:

Go to “Start” type regedit and go to , if for example the Add-In is for Microsoft Word, HKEY_LOCAL_MACHINE->SOFTWARE->Microsoft->Office->Word->Addins->xxxxx.connect then go to LoadBehaviour, left mouse click and reset it to 3 .

• Authentification Issue:

You could face an issue because the authentification of the Add-in DLL to solve that Microsoft provided a quick fix BUT it needs to be installed in Visual Studio 2005, but that will fix the Visual Studio 2008 as well. Have a look and good luck:

http://codinghut.com/2007/12/visual-studio-shared-add-in-wont-load/

• Disable/Enable Add-In’s in Office 2003 and Office 2007:
Microsoft Office applications can disable add-ins that behave unexpectedly while they are being loaded. If an application does not load your add-in when you try to debug it, the application might have hard disabled or soft disabled your add-in.
There are different processes for re-enabling add-ins, depending on the application.
Hard-Disabled Add-ins
Hard disabling occurs when user code that runs while the add-in is loaded causes the application to close unexpectedly, and when you stop the debugger while the constructor or the Startup event handler is executing.
The procedure is the same for all Microsoft Office 2003 applications.
To re-enable an add-in that has been hard disabled by a Microsoft Office 2003 application
1. On the Help menu, click About Microsoft Office .
2. Click Disabled Items.
Add-ins created with Visual Studio Tools for Office appear in the list of disabled items as "Addin:AddinLoader.dll"
3. Select the add-in and click Enable.
The 2007 Microsoft Office System
There are two different procedures for applications in the 2007 Microsoft Office system. The one you use depends on the application.
To re-enable an add-in that has been hard disabled by Excel 2007, PowerPoint 2007, or Word 2007
1. In the application, click the Microsoft Office Button.
2. Click the Options button.
3. In the categories pane, click Add-ins.
4. In the details pane, locate the add-in in the Disabled Application Add-ins list.
The Name column specifies the name of the assembly, and the Location column specifies the full path of the application manifest.
5. In the Manage box, click Disabled Items, and then click Go.
6. Select the add-in and click Enable.
7. Click Close.
To re-enable an add-in that has been hard disabled by InfoPath 2007, Outlook 2007, or Visio 2007
1. On the Tools menu, click Trust Center.
2. In the categories pane, click Add-ins.
3. In the details pane, locate the add-in in the Disabled Application Add-ins list.
The Name column specifies the name of the assembly, and the Location column specifies the full path of the application manifest.
4. In the Manage box, click Disabled Items, and then click Go.
5. Select the add-in and click Enable.
6. Click Close.
Soft-Disabled Add-ins
Soft disabling occurs when an add-in throws an unhandled exception in the constructor or the Startup event handler, but the application does not unexpectedly close.
Note

When you re-enable a soft-disabled add-in, the application immediately attempts to load the add-in. If the problem that initially caused the application to soft disable the add-in has not been fixed, the application will soft disable the add-in again.
There are two different procedures for applications in Microsoft Office 2003. The one you use depends on the application.
To re-enable an add-in that has been soft disabled by Outlook 2003
1. On the Tools menu, click Options.
2. On the Other tab, click Advanced Options.
3. Click COM Add-Ins.
4. Select the check box next to the disabled add-in and click OK.
To re-enable an add-in that has been soft disabled by Excel 2003, PowerPoint 2003, Visio 2003, or Word 2003
1. On the View menu, point to Toolbars, and then click Customize.
2. Click the Commands tab.
3. In the Categories box, click Tools.
4. In the Commands box, select COM Add-Ins and drag it to a toolbar.
5. Click Close.
6. On the toolbar, click COM Add-Ins.
7. Select the check box next to the disabled add-in and click OK.
The 2007 Microsoft Office System
There are two different procedures for applications in the 2007 Microsoft Office system. The one you use depends on the application.
To re-enable an add-in that has been soft disabled by Excel 2007, PowerPoint 2007, or Word 2007
1. In the application, click the Microsoft Office Button.
2. Click the Options button.
3. In the categories pane, click Add-ins.
4. In the details pane, locate the add-in in the Inactive Application Add-ins list.
The Name column specifies the name of the assembly, and the Location column specifies the full path of the application manifest.
5. In the Manage box, click COM Add-ins, and then click Go.
6. In the COM Add-Ins dialog box, select the check box next to the disabled add-in.
7. Click OK.
To re-enable an add-in that has been soft disabled by InfoPath 2007, Outlook 2007, or Visio 2007
1. On the Tools menu, click Trust Center.
2. In the categories pane, click Add-ins.
3. In the details pane, locate the add-in in the Inactive Application Add-ins list.
The Name column specifies the name of the assembly, and the Location column specifies the full path of the application manifest.
4. In the Manage box, click COM Add-ins, and then click Go.
5. In the COM Add-Ins dialog box, select the check box next to the disabled add-in.
6. Click OK.


• The new profile fix:


This solution it could be quite drastic, but I have experienced that as soon as you remove the LOCAL_USER keys from the registry, the add-in’s start working again. To void doing a mess in your computer, the only thing you need to do is remove your current profile and create a new one. You can use the same name, that doesn’t affect.

After that everything will start working again.


• The backup registry fix:

Another option is Backup your registry and as soon as you have an Add-In problem, you can restore it, but that can cause problems if you have new keys in your registry.


• The Registry fix:

In order to avoid the previous issue, it is better do a backup of the keys you really need. As soon as you install the Add-In and if you see that Is working keep the following keys in a xxx.reg file (you can create it with a notepad). Be aware YOU HAVE TO identified these keys, don’t use this example as the Add-In name and the Unique ID’s (ie: {6C531060-84FB-4F96-8F33-29DF020632EB}) will be different.

By the way, for no reason I called the Add-In "Kenia":


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\C:|Program Files|Pannone LLP|keniaSetup|kenia.dll]
"kenia,Version=\"1.0.3306.18159\",Culture=\"neutral\",ProcessorArchitecture=\"MSIL\""=hex(7):66,\
00,4b,00,42,00,67,00,25,00,7b,00,77,00,37,00,71,00,40,00,4e,00,49,00,5e,00,\
4d,00,2b,00,35,00,65,00,76,00,4f,00,68,00,3e,00,6c,00,69,00,4b,00,44,00,34,\
00,60,00,32,00,35,00,7b,00,57,00,56,00,36,00,6e,00,4c,00,6d,00,47,00,57,00,\
50,00,27,00,24,00,00,00,00,00


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Features\E60F08803B5515D41B0C44A1CCEAA75C]
"DefaultFeature"=""


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\E60F08803B5515D41B0C44A1CCEAA75C]
"ProductName"="keniaSetup"
"PackageCode"="ACB74446016467A47B2A3FF9AC77C762"
"Language"=dword:00000409
"Version"=dword:01000000
"Assignment"=dword:00000001
"AdvertiseFlags"=dword:00000184
"InstanceType"=dword:00000000
"AuthorizedLUAApp"=dword:00000000
"Clients"=hex(7):3a,00,00,00,00,00


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\E60F08803B5515D41B0C44A1CCEAA75C\SourceList]
"PackageName"="keniaSetup.msi"
"LastUsedSource"=hex(2):6e,00,3b,00,31,00,3b,00,43,00,3a,00,5c,00,64,00,65,00,\
62,00,75,00,67,00,32,00,5c,00,00,00


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\E60F08803B5515D41B0C44A1CCEAA75C\SourceList\Media]
"1"=";"


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\E60F08803B5515D41B0C44A1CCEAA75C\SourceList\Net]
"1"=hex(2):43,00,3a,00,5c,00,64,00,65,00,62,00,75,00,67,00,32,00,5c,00,00,00


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\UpgradeCodes\7BE7F8489F100994FBDAAD375DEA397A]
"E60F08803B5515D41B0C44A1CCEAA75C"=""


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\kenia.Connect]
@="kenia.Connect"


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\kenia.Connect\CLSID]
@="{666C3AF2-9AE8-42FD-9E5A-E46D52F8CB02}"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Access\AddIns\kenia.Connect]
"LoadBehavior"=dword:00000003
"Description"="kenia"
"FriendlyName"="kenia"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\FrontPage\Addins\kenia.Connect]
"Description"="kenia"
"FriendlyName"="kenia"
"LoadBehavior"=dword:00000003


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\InfoPath\Addins\kenia.Connect]
"Description"="kenia"
"LoadBehavior"=dword:00000003
"FriendlyName"="kenia"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\MS Project\Addins\kenia.Connect]
"FriendlyName"="kenia"
"LoadBehavior"=dword:00000003
"Description"="kenia"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins\kenia.Connect]
"LoadBehavior"=dword:00000003
"FriendlyName"="kenia"
"Description"="kenia"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\PowerPoint\Addins\kenia.Connect]
"LoadBehavior"=dword:00000003
"Description"="kenia"
"FriendlyName"="kenia"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Publisher\Addins\kenia.Connect]
"LoadBehavior"=dword:00000003
"Description"="kenia"
"FriendlyName"="kenia"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Word\Addins\kenia.Connect]
"Description"="kenia"
"FriendlyName"="kenia"
"LoadBehavior"=dword:00000003

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc]
"DCOM Protocols"=hex(7):6e,00,63,00,61,00,63,00,6e,00,5f,00,69,00,70,00,5f,00,\
74,00,63,00,70,00,00,00,6e,00,63,00,61,00,63,00,6e,00,5f,00,73,00,70,00,78,\
00,00,00,6e,00,63,00,61,00,63,00,6e,00,5f,00,6e,00,62,00,5f,00,6e,00,62,00,\
00,00,6e,00,63,00,61,00,63,00,6e,00,5f,00,6e,00,62,00,5f,00,69,00,70,00,78,\
00,00,00,00,00
"UuidSequenceNumber"=dword:7f78bd81


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Visio\Addins\kenia.Connect]
"Description"="kenia"
"LoadBehavior"=dword:00000003
"FriendlyName"="kenia"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders]
"C:\\Program Files\\Pannone LLP\\keniaSetup\\"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes\7BE7F8489F100994FBDAAD375DEA397A]
"E60F08803B5515D41B0C44A1CCEAA75C"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\00F626B354E4BC38A9CC21030B2DAD63]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Excel\\AddIns\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\02BDBB1BEFB206E18F8A840D9558E83A]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\FrontPage\\Addins\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\04E2341B1D5EC8D830A39E2F4B98F4B9]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Publisher\\Addins\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0C6274E9CCB9254FED22DEC3D2687A2F]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\PowerPoint\\Addins\\kenia.Connect\\"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0E70D6E0F12035FC8289085647EFA9CE]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Publisher\\Addins\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Publisher\\Addins\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\1827D583D6F4428829DD49A328AD8B75]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\MS Project\\Addins\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\2165F6560ABF83F1875299796A033EFE]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\FrontPage\\Addins\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\FrontPage\\Addins\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\23C52305960B4ABD905C7B45F77C14EC]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Excel\\AddIns\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\246C0802FB87219FC15636939D466522]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Publisher\\Addins\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\2BBBAFE0468ED95DA1FC609A065CB932]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\PowerPoint\\Addins\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\PowerPoint\\Addins\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\2FA3C6668EA9DF24E9A54ED6258FBC20]
"E60F08803B5515D41B0C44A1CCEAA75C"="00:\\CLSID\\{666C3AF2-9AE8-42FD-9E5A-E46D52F8CB02}\\InprocServer32\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\335B2D56A241B6D2AD4D7C29D94A9891]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\FrontPage\\Addins\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\33771028F6754305FDD3749E4D90E181]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Publisher\\Addins\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\37CD621A59184DF00C2485D742777C05]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Excel\\AddIns\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\3970344D8C2A054B349F341347662BC7]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Visio\\Addins\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\3A8394CB924C547F2F9DCD3F783D2C39]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\InfoPath\\Addins\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\3F314C4F45578A422126435F83C2842D]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Excel\\AddIns\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Excel\\AddIns\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\48BA53B3A215775E56A79AFE2F60474D]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Visio\\Addins\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Visio\\Addins\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\4CED9B7CF850094452997E6E95C5CB23]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\4CFB24612E2D4AB50C2BF936FA7ED508]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Publisher\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Publisher\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\57FFFD3775EC3087D2EA4BB236A1DB17]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Access\\AddIns\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\5B3597813DD9A2D4479B064DE05A0EB6]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Access\\AddIns\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Access\\AddIns\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\63BA09F20EA09235BB6894A6F9D5F502]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Outlook\\AddIns\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\71F1992DBC5F6CADDBFC9C58951901D5]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\PowerPoint\\Addins\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\73CD0BD425DE5FF3698089311B7B4086]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Excel\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Excel\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\740053F8FDB844570B1D24FD90EBC3BF]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Visio\\Addins\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\745699F6BE13C0E9E01AC7E2F2849B47]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\PowerPoint\\Addins\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\7A7B715A3AA4262B12F89F6338139201]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Visio\\Addins\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\826720E273DE8A8E8CAB5CEB5658393D]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\InfoPath\\Addins\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\830CAD9A294B08F1FC5CB1381C0FF87C]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\InfoPath\\Addins\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\84565B9FFAFCD1C1A18806B8CEA60A42]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Outlook\\AddIns\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\852D6AE87281C718653351008CB5FFE9]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Access\\AddIns\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\87E52797604FE00DABB16193F061546F]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Outlook\\AddIns\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Outlook\\AddIns\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\98B5F5C28F51F7CF64B5716474E3F230]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\InfoPath\\Addins\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\InfoPath\\Addins\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\9B7C92712C7F742B22567C796151F649]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Visio\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Visio\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\9C3A8756DB252F1174564145C3B1DCF2]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Access\\AddIns\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\9E07EB1292688DF51354A84E6FEEFAD4]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\InfoPath\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\InfoPath\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\9E405AAABA79372C757B1672955C3E96]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Outlook\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Outlook\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\A4E92D23F09AE359DD93CE4D70976430]
"E60F08803B5515D41B0C44A1CCEAA75C"="C:\\Program Files\\Pannone LLP\\keniaSetup\\kenia.dll"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\A99171FD28E596AA178134F96F0ECF60]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\MS Project\\Addins\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\AFDCA3DB4274E80B0D807FE794A0071F]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Visio\\Addins\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\B078AD81E0CFFE64A95745B59518BEDF]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Outlook\\AddIns\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\B1B13485098296D52D6488D61FB191A0]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Word\\Addins\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\B5DF2DE4579E91EE128096D9F8B9AAE2]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Word\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Word\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\BC053C7E6D52F6C0E51CB161D9309A1B]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Word\\Addins\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\BC769D6C0493ACF29297A3607FDB493F]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Word\\Addins\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\BD7BF318560AA481248EA3119D564E74]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\MS Project\\Addins\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\MS Project\\Addins\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C00083599C0FAD3EAF026172DD27EAC7]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Publisher\\Addins\\kenia.Connect\\Description"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C3F8B8423F9A0483D2CC17B386FD8403]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\FrontPage\\Addins\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C6BEA0B69C7DA38D2B2A72FCEE849B56]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Outlook\\AddIns\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C7A72F167ACB59A82E95B9F29602647F]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\FrontPage\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\FrontPage\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C8A0C6833FFA88BC17B435627B59764F]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\MS Project\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\MS Project\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\CA71E38195EA59E95C43871E282E40B3]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\MS Project\\Addins\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\D20BA88C00277003FDB62EFCB324473C]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DE2D811AFF0AAAC8AA08CBAB435DFBAF]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Excel\\AddIns\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DEE6AAE689707A2CB340EBA268B6BF26]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\PowerPoint\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\PowerPoint\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\E1B928934050CADC077808BD9D47A541]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Word\\Addins\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Word\\Addins\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\E1C9D693FE58BBE0475A1D3EF0E1D298]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Word\\Addins\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\E5164DD1441528F58B6957BDEA146CC5]
"32536FE7914BA3F4CB5DE2F1F1171E6D"="02:\\Software\\Microsoft\\Office\\Access\\"
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Access\\"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\EF36400162F61239CD53BBE25F048698]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\PowerPoint\\Addins\\kenia.Connect\\LoadBehavior"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\F3E8639C277ACA9D83D00DA5CB9DEE36]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\MS Project\\Addins\\kenia.Connect\\FriendlyName"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\F43CB762E1C403105D2136162789ACBA]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\FrontPage\\Addins\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\F747BB38E7AA878FC55548CB10580172]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\InfoPath\\Addins\\kenia.Connect\\FriendlyName"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\FB76B06D225238162CC3EDE0C7CB47BB]
"E60F08803B5515D41B0C44A1CCEAA75C"="02:\\Software\\Microsoft\\Office\\Access\\AddIns\\kenia.Connect\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\E60F08803B5515D41B0C44A1CCEAA75C]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\E60F08803B5515D41B0C44A1CCEAA75C\Features]
"DefaultFeature"="M)A4i8Z'&=a0(6sxr&B4Y5YNi~]+M3}h2nk.7ZngM+IDA6?aTuXF?ZZ'Ks~2Hg,Q6V)g+k~(WVo6^%V)Q$EvhFAXF3a%1!%gzF@wO%7GDRfs$F3cA5KXnr8&E0SQsJOc~&z*}+*zpP+b0@sN6hNPg'Mei6rbjR*T*TvY,J05dFtoHUo7*RnEn([r*gf+m@2pw9m!&+bJ,0OlmTrwDGjD3k'8e*9e.9*qUfAH]QrA=%!@&_+[t~)]H8q?j(9vz$C~MsF3F$Y8Mu8bXN5O~&2%@6WLcxpp-f+JmFdHONra!D{@C^5=2^Pw0z~?nT=1q~$$`+jSeS$6Pxq&(Hw*maQWL5xk20t!ks+dcBf{Q%!mP08Z_eg]--]mg.R-hn.i[8kDRnnzqxq@)Ze7}4W0tgmPGWq}UT*.XA3E@9Pxf[*[Hr1{%-L1RfX!-O+v-`CG0o4PH!%zRAGTn06`8iQ-b}Toi,4.*yk5'4X]I}cfHT'kZ2-+t2Wc2a5+NfGh.=Qi)6zPz+7=+*T3Zl.1*.f[NEI)]$HHFp9Q2P+_'mtr^kz0x]Hywl&uV)]kQt9+kAwvu{s8$rh*~OyM-myG'yF^kM60=(&.WiQzWL$i7r&rlW0NT1)P20]{aO~~QUB4()wQuvvYdyH.6vGCKj_X!C0~NrVw~_xUQ7O]m*I.eU(==$,?!3YdpslNj_?Or3[XLu8%K2wait+^znCfu3Eg&(-HBj?l*eOF{Z~5YOqxWD{6]Xo,68k8iShOHo6@}O4Dgrnp_L)5RgkQr`0?3l%J@8l%OWcwrkMYUE60hn0xu7L@36*qfBt2`1JOLHJ-Xh{}*j9xl=9i%FEB%n[zKI@JJ-`1RnuO8Yk$H}cH+li9y2H,&,bE^lTDwZj.6KL{@HKDW8s(@A)SnaLI=MgawjqNk.r-fmwRwaYl@XQl[y2O*(Vp?@P,klzA5@tjAn(KZoXoI7C%Se@k1-C*7a$PFR~[BN3h[X^5M8~j[UXq5UvXL$eBX4ZyH]=XK-`cWgP&bg1yy)nGJn6n'=wj`mmb]C_cakM.J0}rZ(4^TwSFMY7w6'~vITX0(sqM@Wz!`$3P3n1Tv3Bcl2ohBoZby~R&0LvE.3jrKEGclZ(F{x2yxiSM?KlM*-bMAbeaLkXW@'eWt)V%7VXihrL^A%vkw}?m+Qi6mCS!zb*jso3-GY)P=MVne!7Bhax.VmP.pmZvD^0(^&N9Db_Jqa5lER4(0w9%VM2^cMxg8ip!ZThyliKD4`25{WV6nLmGWP'$!V)wHAH,U9tt-CKAGJu!"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\E60F08803B5515D41B0C44A1CCEAA75C\InstallProperties]
"LocalPackage"="C:\\WINDOWS\\Installer\\262424.msi"
"AuthorizedCDFPrefix"=""
"Comments"=""
"Contact"="Pannone LLP"
"DisplayVersion"="1.0.0"
"HelpLink"=""
"HelpTelephone"=""
"InstallDate"="20090119"
"InstallLocation"=""
"InstallSource"="C:\\debug2\\"
"ModifyPath"=hex(2):4d,00,73,00,69,00,45,00,78,00,65,00,63,00,2e,00,65,00,78,\
00,65,00,20,00,2f,00,49,00,7b,00,30,00,38,00,38,00,30,00,46,00,30,00,36,00,\
45,00,2d,00,35,00,35,00,42,00,33,00,2d,00,34,00,44,00,35,00,31,00,2d,00,42,\
00,31,00,43,00,30,00,2d,00,34,00,34,00,31,00,41,00,43,00,43,00,41,00,45,00,\
37,00,41,00,43,00,35,00,7d,00,00,00
"Publisher"="Pannone LLP"
"Readme"=""
"Size"=""
"EstimatedSize"=dword:00000176
"UninstallString"=hex(2):4d,00,73,00,69,00,45,00,78,00,65,00,63,00,2e,00,65,00,\
78,00,65,00,20,00,2f,00,49,00,7b,00,30,00,38,00,38,00,30,00,46,00,30,00,36,\
00,45,00,2d,00,35,00,35,00,42,00,33,00,2d,00,34,00,44,00,35,00,31,00,2d,00,\
42,00,31,00,43,00,30,00,2d,00,34,00,34,00,31,00,41,00,43,00,43,00,41,00,45,\
00,37,00,41,00,43,00,35,00,7d,00,00,00
"URLInfoAbout"=""
"URLUpdateInfo"=""
"VersionMajor"=dword:00000001
"VersionMinor"=dword:00000000
"WindowsInstaller"=dword:00000001
"Version"=dword:01000000
"Language"=dword:00000409
"DisplayName"="keniaSetup"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\E60F08803B5515D41B0C44A1CCEAA75C\Patches]
"AllPatches"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\E60F08803B5515D41B0C44A1CCEAA75C\Usage]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0880F06E-55B3-4D51-B1C0-441ACCAE7AC5}]
"AuthorizedCDFPrefix"=""
"Comments"=""
"Contact"="Pannone LLP"
"DisplayVersion"="1.0.0"
"HelpLink"=""
"HelpTelephone"=""
"InstallDate"="20090119"
"InstallLocation"=""
"InstallSource"="C:\\debug2\\"
"ModifyPath"=hex(2):4d,00,73,00,69,00,45,00,78,00,65,00,63,00,2e,00,65,00,78,\
00,65,00,20,00,2f,00,49,00,7b,00,30,00,38,00,38,00,30,00,46,00,30,00,36,00,\
45,00,2d,00,35,00,35,00,42,00,33,00,2d,00,34,00,44,00,35,00,31,00,2d,00,42,\
00,31,00,43,00,30,00,2d,00,34,00,34,00,31,00,41,00,43,00,43,00,41,00,45,00,\
37,00,41,00,43,00,35,00,7d,00,00,00
"Publisher"="Pannone LLP"
"Readme"=""
"Size"=""
"EstimatedSize"=dword:00000176
"UninstallString"=hex(2):4d,00,73,00,69,00,45,00,78,00,65,00,63,00,2e,00,65,00,\
78,00,65,00,20,00,2f,00,49,00,7b,00,30,00,38,00,38,00,30,00,46,00,30,00,36,\
00,45,00,2d,00,35,00,35,00,42,00,33,00,2d,00,34,00,44,00,35,00,31,00,2d,00,\
42,00,31,00,43,00,30,00,2d,00,34,00,34,00,31,00,41,00,43,00,43,00,41,00,45,\
00,37,00,41,00,43,00,35,00,7d,00,00,00
"URLInfoAbout"=""
"URLUpdateInfo"=""
"VersionMajor"=dword:00000001
"VersionMinor"=dword:00000000
"WindowsInstaller"=dword:00000001
"Version"=dword:01000000
"Language"=dword:00000409
"DisplayName"="keniaSetup"

Wednesday, 3 December 2008

Dealing with email events with Outlook and Add-in s

Dealing with email events with Outlook and Add-in s

I have explained already how to place a button in the standard bar. The problem we have now, it is how to capture an evenet when we decide to open, close, send, reply... an email. Microsoft provides the InspectorsClass [Microsoft.Office.Interop.Outlook.InspectorsClass] , this class allows you to capture the "NewInspector" event [InspectorsEvents_NewInspectorEventHandler] . This event is one that is fired when we decide to mess around with one email item.

Once we enter in the event it is time to deal with the item, so basically we have to decide what to do.

I am going to paste 3 classes:
    • Connect.cs
    • OleCreateConverter.cs
    • OutlookMailItemEventArgs.cs
OutlookMailItemEventArgs contains the events that deal with Item itself. What I dod it is create a button main standard toolbar and when we open a new email I attach a button called "Send...". When you click it removes the subject of the Item.

Connect.cs

namespace WSSSaveAsOutlookAddIn
{
using System;
using Extensibility;
using System.Runtime.InteropServices;
using Microsoft.Office.Core;
using System.Reflection;
using System.Windows.Forms;
using System.Collections;



[GuidAttribute("0632A014-721A-4545-8B36-12D7CC4373B4"), ProgId("WSSSaveAsOutlookAddIn.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2
{
//private WSSSaveAsWord.SaveAs _fSaveAsForm;

private CommandBarButton _cbbToolBarButton;

//## Current email.
private Microsoft.Office.Interop.Outlook.MailItem _msgMailItem;

//## OutLook Explorer.
private Microsoft.Office.Interop.Outlook.Explorer _outlookExplorer;

//## Application
private Microsoft.Office.Interop.Outlook._Application _outlookApplication;

//## Email Item.
private Microsoft.Office.Interop.Outlook.MailItem _miMailItem;

//## InspectorsClass.
private Microsoft.Office.Interop.Outlook.InspectorsClass _insInspectors;

//## This Hashtable holds a reference to the active Inspectors
private Hashtable _ActiveItems = null;

public Connect()
{
//_fSaveAsForm.OfficeProduct = WSSSaveAsWord.SaveAs.OfficeProductType.Outlook;
//_fSaveAsForm = new WSSSaveAsWord.SaveAs();
//_fSaveAsForm.OfficeProduct = WSSSaveAsWord.SaveAs.OfficeProductType.Outlook;
}

public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;

_outlookApplication = application as Microsoft.Office.Interop.Outlook._Application;

if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
{
OnStartupComplete(ref custom);
}


}

public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
{
if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
{
OnBeginShutdown(ref custom);
}
applicationObject = null;

}


public void OnAddInsUpdate(ref System.Array custom)
{
}

private void Mail_Item_Closed(object sender, OutlookMailItemEventArgsConnect.OutlookMailItemEventArgs e)
{
// Remove Item from Collection
_ActiveItems.Remove(e.HashCode);
}


private void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
try
{
object Item = Inspector.CurrentItem;

//## Check the ItemsType
if (Item is Microsoft.Office.Interop.Outlook.MailItem)
{
//## Create a new Item wrapper Object
OutlookMailItemEventArgsConnect.OutlookMailItem _oiMail = new OutlookMailItemEventArgsConnect.OutlookMailItem(Item);

//## Register for the Item Close event
_oiMail.Item_Closed += new OutlookMailItemEventArgsConnect.OutlookMailItemEventHandler(Mail_Item_Closed);

//## remember the Item in Collection
_ActiveItems.Add(_oiMail.HashCode, _oiMail);
}
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}


public void OnStartupComplete(ref System.Array custom)
{

//## The toolbar is declared
CommandBars oCommandBars;

//## The toolbar where our button will be added is declared
CommandBar oStandardBar;

try
{
//## Selection event.
_outlookExplorer = _outlookApplication.ActiveExplorer();
_outlookExplorer.SelectionChange += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(outlookExplorer_SelectionChange);

//### FROM HERE WE HANDLE THE ITEM EVENTS ###
//## Open Item
// Create a new Hashtable Object
_ActiveItems = new Hashtable(25);

// Get the Outlook Inspectors Collection
_insInspectors = (Microsoft.Office.Interop.Outlook.InspectorsClass)_outlookApplication.Inspectors;

// Register for the NewInspector event
_insInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
//############################################
}
catch(Exception)
{

}

try
{
//## We try to get the bar,
oCommandBars = (CommandBars)applicationObject.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty, null, applicationObject, null);
}
catch (Exception)
{
oCommandBars = (CommandBars)_outlookApplication.ActiveExplorer();

//## Outlook has the CommandBars collection on the Explorer object.
object oActiveExplorer;
oActiveExplorer = applicationObject.GetType().InvokeMember("ActiveExplorer", BindingFlags.GetProperty, null, applicationObject, null);
oCommandBars = (CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty, null, oActiveExplorer, null);
}

//## Set up a custom button on the "Standard" commandbar.
try
{
//## Its main toolbar Standard.
oStandardBar = oCommandBars["Standard"];
}
catch (Exception)
{
//## Access names its main toolbar Database.
oStandardBar = oCommandBars["Database"];
}

//## In case the button was not deleted, use the exiting one.
try
{
_cbbToolBarButton = (CommandBarButton)oStandardBar.Controls["Sharepoint Save"];
}
catch (Exception)
{
object omissing = System.Reflection.Missing.Value;

//## The command bar is added into the standar bar.
_cbbToolBarButton = (CommandBarButton)oStandardBar.Controls.Add(1, omissing, omissing, omissing, omissing);

//## The caption is set
_cbbToolBarButton.Caption = "Sharepoint Save";

//## We set the style...We want text and one icon!
_cbbToolBarButton.Style = MsoButtonStyle.msoButtonIconAndCaption;
}

// The following items are optional, but recommended.
//The Tag property lets you quickly find the control
//and helps MSO keep track of it when more than
//one application window is visible. The property is required
//by some Office applications and should be provided.
_cbbToolBarButton.Tag = "Sharepoint Save";

// The OnAction property is optional but recommended.
//It should be set to the ProgID of the add-in, so that if
//the add-in is not loaded when a user presses the button,
//MSO loads the add-in automatically and then raises
//the Click event for the add-in to handle.
_cbbToolBarButton.OnAction = "!";

//## We grab the image from our resources
System.Drawing.Image _imgToolBarImage =Properties.Resources.ToolBarIcon;

//## We make our button visible.
_cbbToolBarButton.Visible = true;

//## We convert from image to IPictureDisp
_cbbToolBarButton.Picture = OleCreateConverter.ImageToPictureDisp(_imgToolBarImage);

//## We set the event
_cbbToolBarButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this._cbbToolBarButton_Click);

object oName = applicationObject.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, applicationObject, null);

// Display a simple message to show which application you started in.
// System.Windows.Forms.MessageBox.Show("This Addin is loaded by " + oName.ToString(), "MyCOMAddin");
oStandardBar = null;
oCommandBars = null;

}


public void OnBeginShutdown(ref System.Array custom)
{
//## Unloading our stuff...
object omissing = System.Reflection.Missing.Value;
_cbbToolBarButton.Delete(omissing);
_cbbToolBarButton = null;

}

private void _cbbToolBarButton_Click(CommandBarButton cmdBarbutton, ref bool cancel)
{
if (this._msgMailItem!=null)
{
//_fSaveAsForm.msgMail = this._msgMailItem;

//_fSaveAsForm.Show();
}

//## Button Clicked
System.Windows.Forms.MessageBox.Show("_cbbToolBarButton was Clicked");
}

private void outlookExplorer_SelectionChange()
{
//## Getting a spare temp file name.
string _sTempFileName = System.IO.Path.GetTempFileName();

//## We check if we have select anything.
if (_outlookExplorer.Selection.Count != 0)
{
try
{
//## Getting the selected email.
Microsoft.Office.Interop.Outlook.MailItem mailItem = _outlookExplorer.Selection[1] as Microsoft.Office.Interop.Outlook.MailItem;

//## It is time to save our stuff...
_msgMailItem = mailItem;
}
catch (Exception ex)
{

}
}
}

private object applicationObject;
private object addInInstance;
}
}

OleCreateConverter.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Drawing;

namespace WSSSaveAsOutlookAddIn
{
internal class OleCreateConverter
{

[DllImport("oleaut32.dll", EntryPoint = "OleCreatePictureIndirect",CharSet = CharSet.Ansi, ExactSpelling = true, PreserveSig = true)]
private static extern int OleCreatePictureIndirect([In] PictDescBitmap pictdesc, ref Guid iid, bool fOwn,[MarshalAs(UnmanagedType.Interface)] out object ppVoid);

const short _PictureTypeBitmap = 1;

[StructLayout(LayoutKind.Sequential)]
internal class PictDescBitmap
{
internal int cbSizeOfStruct = Marshal.SizeOf(typeof(PictDescBitmap));
internal int pictureType = _PictureTypeBitmap;
internal IntPtr hBitmap = IntPtr.Zero;
internal IntPtr hPalette = IntPtr.Zero;
internal int unused = 0;

internal PictDescBitmap(Bitmap bitmap)
{
this.hBitmap = bitmap.GetHbitmap();
}
}

public static stdole.IPictureDisp ImageToPictureDisp(Image image)
{
if (image == null || !(image is Bitmap))
{
return null;
}

PictDescBitmap pictDescBitmap = new PictDescBitmap((Bitmap)image);
object ppVoid = null;
Guid iPictureDispGuid = typeof(stdole.IPictureDisp).GUID;
OleCreatePictureIndirect(pictDescBitmap, ref iPictureDispGuid, true, out ppVoid);
stdole.IPictureDisp picture = (stdole.IPictureDisp)ppVoid;
return picture;
}


public static Image PictureDispToImage(stdole.IPictureDisp pictureDisp)
{
Image image = null;
if (pictureDisp != null && pictureDisp.Type == _PictureTypeBitmap)
{
IntPtr paletteHandle = new IntPtr(pictureDisp.hPal);
IntPtr bitmapHandle = new IntPtr(pictureDisp.Handle);
image = Image.FromHbitmap(bitmapHandle, paletteHandle);
}
return image;
}

}
}
OutlookMailItemEventArgsConnect.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Microsoft.Office.Core;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace OutlookMailItemEventArgsConnect
{

///
/// EventArgs for my event
///

public class OutlookMailItemEventArgs : EventArgs
{
private readonly int _iHashCode = 0;

public int HashCode
{
get { return _iHashCode; }
}

public OutlookMailItemEventArgs(int _iOutlookMailItemEventArgsHashCode)
{
_iHashCode = _iOutlookMailItemEventArgsHashCode;
}
}

///
/// A delegate for my events
///

public delegate void OutlookMailItemEventHandler(object sender, OutlookMailItemEventArgs e);
///
/// This is a wrapper for a MailItemObject
///

public class OutlookMailItem
{

///
/// The "DATA"
///

private Microsoft.Office.Interop.Outlook.MailItem _oiMailItem;

///
/// the Inspector for the Item
///

private Microsoft.Office.Interop.Outlook.InspectorClass _oinsInspector;

///
/// Event, raised when Item is closed
///

public event OutlookMailItemEventHandler Item_Closed;

private int _iID = 0;

///
/// Controls to be modified...
///

private Microsoft.Office.Core.CommandBar _cbarCommandBar = null;
private Microsoft.Office.Core.CommandBarButton _cbarcmdButton = null;

private object _oMissing = System.Reflection.Missing.Value;

///
/// Returns the Hashcode for the Item
///

public int HashCode
{
get {
return _oiMailItem.GetHashCode();
}
}
///
/// The Constructor for the OutlookMailItem
///

public OutlookMailItem(object Item)
{
//## Remember the Object
_oiMailItem = (Microsoft.Office.Interop.Outlook.MailItem)Item;

_iID = _oiMailItem.GetHashCode();

//## Register for Item Open Event
_oiMailItem.Open += new Microsoft.Office.Interop.Outlook.ItemEvents_10_OpenEventHandler(_oiMailItem_Open);


}
///
/// Eventhadler for a Mail Open event.
/// Remember this Item in ActiveItems
/// Create Button here and register for button click events
///

private void _oiMailItem_Open(ref bool Cancel)
{

// event isn't needed anymore
_oiMailItem.Open -= new Microsoft.Office.Interop.Outlook.ItemEvents_10_OpenEventHandler(_oiMailItem_Open);

// get the Inspector here
_oinsInspector = (Microsoft.Office.Interop.Outlook.InspectorClass)_oiMailItem.GetInspector;

// register for the Inspector events
_oinsInspector.InspectorEvents_Event_Close += new Microsoft.Office.Interop.Outlook.InspectorEvents_CloseEventHandler(_oinsInspector_InspectorEvents_Event_Close);

// Create the Menu
CreateMenu();

}

///
/// Eventhandler for the INspector close event
///

private void _oinsInspector_InspectorEvents_Event_Close()
{
try
{
// Raise event, to remove us from active items collection
if (Item_Closed != null)
{
Item_Closed(this, new OutlookMailItemEventArgs(_oiMailItem.GetHashCode()));
}

// Cleanup resources
_oinsInspector.InspectorEvents_Event_Close -= new Microsoft.Office.Interop.Outlook.InspectorEvents_CloseEventHandler(_oinsInspector_InspectorEvents_Event_Close);
Marshal.ReleaseComObject(_oinsInspector);

Marshal.ReleaseComObject(_oiMailItem);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}

///
/// Adds the Menu for the MailItem
///

private void CreateMenu()
{
try
{
if (_oinsInspector == null) return;

//## Add our Own CommandBar to MailItem
_cbarCommandBar = (Microsoft.Office.Core.CommandBar)_oinsInspector.CommandBars.Add("OutlookMailItemEventArgsConnect", _oMissing, _oMissing, true);


//## Add my button
_cbarcmdButton = (Microsoft.Office.Core.CommandBarButton)_cbarCommandBar.Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlButton, _oMissing, _oMissing, 1, 1);

_cbarcmdButton.Caption = "Send...";
_cbarcmdButton.Tag = _iID.ToString();
_cbarcmdButton.Style = Microsoft.Office.Core.MsoButtonStyle.msoButtonIconAndCaption;
//## Use one off 2 zilliards Office Icons....
_cbarcmdButton.FaceId = 24;

//## Register for Click event
_cbarcmdButton.Click += new _CommandBarButtonEvents_ClickEventHandler(_cbarcmdButton_Click);

//## Make Menu Visible in TOP of Menus
_cbarCommandBar.Visible = true;
_cbarCommandBar.Enabled = true;

//## Setting the position...
_cbarCommandBar.Position = Microsoft.Office.Core.MsoBarPosition.msoBarTop;

}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}

///
/// Cleans up any resources for shutdown
///

private void CleanUp()
{
try
{

}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}

///
/// The ResetButton Click eventhandler
///

private void _cbarcmdButton_Click(CommandBarButton Ctrl, ref bool CancelDefault)
{
// Check, if we are in the right MailItem
if (Ctrl.Tag != _iID.ToString()) return;

_oiMailItem.Subject = "";
}
}
}

Friday, 28 November 2008

Add-In for Outlook 2003

It looks simple, but it not that simple...when I mean not simple I mean the lack of information that you get from Microsoft to develop Add-in's, but as everything, after few hours of research you can get the chance of doing something nice customizing your Outlook to the limit.

I am personaly think, that Add-In's in Visual Studio are not developed yet, it seems that Visual Studio only creates a schema of what you need, but it doesm't give you any facility, well at the end of the day it is something that could be improve it in Visual Studio 2010 (I hope Mr. Bill will read this).

For this exercise I am going to create a ToolBar or Button with an image so, when you click it will display a message. You will end having something like this:




On Visual Studio 2005/2008 go to File->New ->Project->Other Project Types->Extensibility->Shared Add-In

Type a name and click on next, next,next...

You will end with a Visual Studio Solution.

Add a resource file, and insert an image resource on it, and call it "ToolBarIcon", this will be the image we will use for our button.

Create a new class and call it "OleCreateConverter.cs" and paste code below, after that go to the "Connect.cs" and paste the code I attatch.

Sometimes when you run these add-in's, they don't work, that is because Office 2003/2007 and Add-in's have a bug that Microsoft has not resolved yet...so even if you remove your profile, or the registry or reinstall Outlook... you will not able to make it work, so avoid to do experiments otherwiese you will have to install the entire operating system + office to keep working.

Anyway, if your Outlook becomes corrupted and you managed to make it work with add-in's please let me know how you did it.

________________________________________________________
OleCreateConverter.cs
________________________________________________________
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Drawing;

namespace WSSSaveAsOutlookAddIn
{
internal class OleCreateConverter
{

[DllImport("oleaut32.dll", EntryPoint = "OleCreatePictureIndirect",CharSet = CharSet.Ansi, ExactSpelling = true, PreserveSig = true)]
private static extern int OleCreatePictureIndirect([In] PictDescBitmap pictdesc, ref Guid iid, bool fOwn,[MarshalAs(UnmanagedType.Interface)] out object ppVoid);

const short _PictureTypeBitmap = 1;

[StructLayout(LayoutKind.Sequential)]
internal class PictDescBitmap
{
internal int cbSizeOfStruct = Marshal.SizeOf(typeof(PictDescBitmap));
internal int pictureType = _PictureTypeBitmap;
internal IntPtr hBitmap = IntPtr.Zero;
internal IntPtr hPalette = IntPtr.Zero;
internal int unused = 0;

internal PictDescBitmap(Bitmap bitmap)
{
this.hBitmap = bitmap.GetHbitmap();
}
}

public static stdole.IPictureDisp ImageToPictureDisp(Image image)
{
if (image == null || !(image is Bitmap))
{
return null;
}

PictDescBitmap pictDescBitmap = new PictDescBitmap((Bitmap)image);
object ppVoid = null;
Guid iPictureDispGuid = typeof(stdole.IPictureDisp).GUID;
OleCreatePictureIndirect(pictDescBitmap, ref iPictureDispGuid, true, out ppVoid);
stdole.IPictureDisp picture = (stdole.IPictureDisp)ppVoid;
return picture;
}


public static Image PictureDispToImage(stdole.IPictureDisp pictureDisp)
{
Image image = null;
if (pictureDisp != null && pictureDisp.Type == _PictureTypeBitmap)
{
IntPtr paletteHandle = new IntPtr(pictureDisp.hPal);
IntPtr bitmapHandle = new IntPtr(pictureDisp.Handle);
image = Image.FromHbitmap(bitmapHandle, paletteHandle);
}
return image;
}

}
}

________________________________________________________
Connect.cs
________________________________________________________
namespace WSSSaveAsOutlookAddIn
{
using System;
using Extensibility;
using System.Runtime.InteropServices;
using Microsoft.Office.Core;
using System.Reflection;

#region Read me for Add-in installation and setup information.
// When run, the Add-in wizard prepared the registry for the Add-in.
// At a later time, if the Add-in becomes unavailable for reasons such as:
// 1) You moved this project to a computer other than which is was originally created on.
// 2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
// 3) Registry corruption.
// you will need to re-register the Add-in by building the WSSSaveAsOutlookAddInSetup project,
// right click the project in the Solution Explorer, then choose install.
#endregion

///
/// The object for implementing an Add-in.
///

///
[GuidAttribute("0632A014-721A-4545-8B36-12D7CC4373B4"), ProgId("WSSSaveAsOutlookAddIn.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2
{
private WSSSaveAsWord.SaveAs _fSaveAsForm;

private CommandBarButton _cbbToolBarButton;

///
/// Implements the constructor for the Add-in object.
/// Place your initialization code within this method.
///

public Connect()
{
}

///
/// Implements the OnConnection method of the IDTExtensibility2 interface.
/// Receives notification that the Add-in is being loaded.
///

/// Root object of the host application.
///
public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;

if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
{
OnStartupComplete(ref custom);
}


}

///
/// Implements the OnDisconnection method of the IDTExtensibility2 interface.
/// Receives notification that the Add-in is being unloaded.
///

///
public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
{
if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
{
OnBeginShutdown(ref custom);
}
applicationObject = null;

}

///
/// Implements the OnAddInsUpdate method of the IDTExtensibility2 interface.
/// Receives notification that the collection of Add-ins has changed.
///

///
public void OnAddInsUpdate(ref System.Array custom)
{
}

///
/// Implements the OnStartupComplete method of the IDTExtensibility2 interface.
/// Receives notification that the host application has completed loading.
///

///
public void OnStartupComplete(ref System.Array custom)
{
//## The toolbar is declared
CommandBars oCommandBars;

//## The toolbar where our button will be added is declared
CommandBar oStandardBar;

try
{
//## We try to get the bar,
oCommandBars = (CommandBars)applicationObject.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty, null, applicationObject, null);
}
catch (Exception)
{
//## Outlook has the CommandBars collection on the Explorer object.
object oActiveExplorer;
oActiveExplorer = applicationObject.GetType().InvokeMember("ActiveExplorer", BindingFlags.GetProperty, null, applicationObject, null);
oCommandBars = (CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty, null, oActiveExplorer, null);
}

//## Set up a custom button on the "Standard" commandbar.
try
{
//## Its main toolbar Standard.
oStandardBar = oCommandBars["Standard"];
}
catch (Exception)
{
//## Access names its main toolbar Database.
oStandardBar = oCommandBars["Database"];
}

//## In case the button was not deleted, use the exiting one.
try
{
_cbbToolBarButton = (CommandBarButton)oStandardBar.Controls["Sharepoint Save"];
}
catch (Exception)
{
object omissing = System.Reflection.Missing.Value;

//## The command bar is added into the standar bar.
_cbbToolBarButton = (CommandBarButton)oStandardBar.Controls.Add(1, omissing, omissing, omissing, omissing);

//## The caption is set
_cbbToolBarButton.Caption = "Sharepoint Save";

//## We set the style...We want text and one icon!
_cbbToolBarButton.Style = MsoButtonStyle.msoButtonIconAndCaption;
}

// The following items are optional, but recommended.
//The Tag property lets you quickly find the control
//and helps MSO keep track of it when more than
//one application window is visible. The property is required
//by some Office applications and should be provided.
_cbbToolBarButton.Tag = "Sharepoint Save";

// The OnAction property is optional but recommended.
//It should be set to the ProgID of the add-in, so that if
//the add-in is not loaded when a user presses the button,
//MSO loads the add-in automatically and then raises
//the Click event for the add-in to handle.
_cbbToolBarButton.OnAction = "!";

//## We grab the image from our resources
System.Drawing.Image _imgToolBarImage =Properties.Resources.ToolBarIcon;

//## We make our button visible.
_cbbToolBarButton.Visible = true;

//## We convert from image to IPictureDisp
_cbbToolBarButton.Picture = OleCreateConverter.ImageToPictureDisp(_imgToolBarImage);

//## We set the event
_cbbToolBarButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this._cbbToolBarButton_Click);

object oName = applicationObject.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, applicationObject, null);

// Display a simple message to show which application you started in.
// System.Windows.Forms.MessageBox.Show("This Addin is loaded by " + oName.ToString(), "MyCOMAddin");
oStandardBar = null;
oCommandBars = null;

}

///
/// Implements the OnBeginShutdown method of the IDTExtensibility2 interface.
/// Receives notification that the host application is being unloaded.
///

///
public void OnBeginShutdown(ref System.Array custom)
{
//## Unloading our stuff...
object omissing = System.Reflection.Missing.Value;
_cbbToolBarButton.Delete(omissing);
_cbbToolBarButton = null;

}

private void _cbbToolBarButton_Click(CommandBarButton cmdBarbutton, ref bool cancel)
{
//## Button Clicked
System.Windows.Forms.MessageBox.Show("_cbbToolBarButton was Clicked");
}


private object applicationObject;
private object addInInstance;
}
}