A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Add-ins not being removed from toolbar



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 29th 06, 09:26 PM posted to microsoft.public.outlook.program_addins
RoyalHale
external usenet poster
 
Posts: 2
Default Add-ins not being removed from toolbar

I am just starting learning to program add-in in C#. I went through a simple
tutorial that just added a button to the standard toolbar and when clicked
had a popup saying "Hello World". When I go to uninstall the add-in through
Visual Studio 2005 and open Outlook up, the button is still there but doesn't
do anything when clicked. When I try to go into the Advanced Options to see
if it is still registered as a Com Addin, it isn't. The big problem is that
everytime I install the control, I get another button added to the toolbar.
So right now I have 6.
I looked in the registery under both hklm and the one for the current user
but don't see any reference to this add-in.
Below is the code I use to build the control and to then delete it.
Any ideas on how to get rid of all those extra buttons?

public void OnStartupComplete(ref System.Array custom)
{
CommandBars commandBars =
applicationObject.ActiveExplorer().CommandBars;

try
{
this.toolbarButton =
(CommandBarButton)commandBars["Standard"].Controls["AddSave"];
}
catch (System.Exception)
{
this.toolbarButton =
(CommandBarButton)commandBars["Standard"].Controls.Add(1,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value,

System.Reflection.Missing.Value,

System.Reflection.Missing.Value);

this.toolbarButton.Caption = "Add/Save";
this.toolbarButton.Style = MsoButtonStyle.msoButtonCaption;

}
this.toolbarButton.Tag = "AddSave";
this.toolbarButton.OnAction = "!RecordEmail.Connect";
this.toolbarButton.Visible = true;
this.toolbarButton.Click += new
_CommandBarButtonEvents_ClickEventHandler(this.OnT oolbarButtonClick);

}

Below I try 2 ways to delete the item:

public void OnBeginShutdown(ref System.Array custom)
{
CommandBars commandBars =
applicationObject.ActiveExplorer().CommandBars;
try
{

commandBars["Standard"].Controls["AddSave"].Delete(System.Reflection.Missing.Value);
}
catch
{

}
object omissing = System.Reflection.Missing.Value;

this.toolbarButton.Delete(omissing);
this.toolbarButton = null;
}

--
Thanks
Royal
Ads
  #2  
Old December 1st 06, 04:04 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Add-ins not being removed from toolbar

By the time the shutdown code has fired the event the buttons are out of
scope. You should handle the Explorer.Close event and delete your buttons
there. You also should use the Temporary argument and set it true when you
create the buttons.

To get rid of the existing ones, which will persist forever even without
your addin there since they were added permanently follow these steps.
Right-click on the toolbar and select Customize. Drag the orphaned buttons
off of the toolbar. Exit Customize mode.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"RoyalHale" wrote in message
...
I am just starting learning to program add-in in C#. I went through a
simple
tutorial that just added a button to the standard toolbar and when clicked
had a popup saying "Hello World". When I go to uninstall the add-in
through
Visual Studio 2005 and open Outlook up, the button is still there but
doesn't
do anything when clicked. When I try to go into the Advanced Options to
see
if it is still registered as a Com Addin, it isn't. The big problem is
that
everytime I install the control, I get another button added to the
toolbar.
So right now I have 6.
I looked in the registery under both hklm and the one for the current user
but don't see any reference to this add-in.
Below is the code I use to build the control and to then delete it.
Any ideas on how to get rid of all those extra buttons?

public void OnStartupComplete(ref System.Array custom)
{
CommandBars commandBars =
applicationObject.ActiveExplorer().CommandBars;

try
{
this.toolbarButton =
(CommandBarButton)commandBars["Standard"].Controls["AddSave"];
}
catch (System.Exception)
{
this.toolbarButton =
(CommandBarButton)commandBars["Standard"].Controls.Add(1,
System.Reflection.Missing.Value,

System.Reflection.Missing.Value,

System.Reflection.Missing.Value,

System.Reflection.Missing.Value);

this.toolbarButton.Caption = "Add/Save";
this.toolbarButton.Style = MsoButtonStyle.msoButtonCaption;

}
this.toolbarButton.Tag = "AddSave";
this.toolbarButton.OnAction = "!RecordEmail.Connect";
this.toolbarButton.Visible = true;
this.toolbarButton.Click += new
_CommandBarButtonEvents_ClickEventHandler(this.OnT oolbarButtonClick);

}

Below I try 2 ways to delete the item:

public void OnBeginShutdown(ref System.Array custom)
{
CommandBars commandBars =
applicationObject.ActiveExplorer().CommandBars;
try
{

commandBars["Standard"].Controls["AddSave"].Delete(System.Reflection.Missing.Value);
}
catch
{

}
object omissing = System.Reflection.Missing.Value;

this.toolbarButton.Delete(omissing);
this.toolbarButton = null;
}

--
Thanks
Royal


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NNTP add-ins for 2003? Gordon Outlook - General Queries 4 November 20th 06 09:48 AM
Question in outlook Add-ins Marwa Outlook - Using Forms 0 August 16th 06 10:14 PM
C++ add ins for Outloo Carlos Add-ins for Outlook 1 August 14th 06 04:11 PM
comm add-ins leonS Outlook - Installation 1 May 1st 06 07:09 PM
New to add-ins Sharad Naik Add-ins for Outlook 9 January 26th 06 02:04 PM


All times are GMT +1. The time now is 11:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.