Problem uninstalling outlook toolbar

Add-in Express™ Support Service
That's what is more important than anything else

Problem uninstalling outlook toolbar
 
Dom




Posts: 5
Joined: 2005-04-22
Hello everyone,

My company has purchased the ADX software and I have used it to create an Outlook add-in which creates a toolbar.

Everything works very well so far, but when uninstalling the add-in, the toolbar remains in the Outlook gui.

The setup project contains the custom action for AddinExpress.MSO.dll for the rollback and uninstall sections. The DLLs get deleted and the add-in doesn't appear anymore in Outlook's "COM Add-ins..." window after uninstalling.

But the toolbar and its buttons remain in the GUI. Clicking them does absolutely nothing. I can remove the toolbar manually by right mouse-clicking the Outlook menu and then selecting Customize->toolbars tab->Delete.

But is there a way to completely remove the toolbar from the outlook menu during the uninstall?

Thanks for your time.
Posted 22 Apr, 2005 11:20:22 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Dom.

ADX removes all its command bars from all MS Office applications except Outlook. As to Outlook we recommend setting the Temporary property of ADXOlExplorerCommandBar and ADXOlInspectorCommandBar to true so that they will be deteled automatically after Outlook closes.

Posted 22 Apr, 2005 11:39:19 Top
Dom




Posts: 5
Joined: 2005-04-22
Hi Sergey,

Thanks for the swift response.

I am using an ADXCommandBar as I need it to show in the toolbar area all the time, regardless of which folder is highlighted or what the user is doing. (Incidentally, I tried an ADXOlExplorerCommandBar previously and received an uncaught exception whenever I would click on my IMAP inbox folder. But the Explorer Command Bar worked with other folders.)

I have played with the Temporary property as you have suggested, but now it still leaves behind a small empty toolbar when I uninstall.

If AddinExpress.MSO.dll does not support removing this, is there a way I can create my own custom action to remove it? Would you have some url or example code to recommend?

Thanks again.
Posted 22 Apr, 2005 12:54:09 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Dom, what version of Outlook do you use?
Have you already updated ADX up to 2.3 Public Preview version?
Could you send me the code that causes an uncaught exception?


Would you have some url or example code to recommend?

I will try to find the example code for you.
Posted 22 Apr, 2005 13:10:20 Top
Dom




Posts: 5
Joined: 2005-04-22
I am using ADX 2.2 public preview for .NET and Outlook 2000. But I also have to support Outlook 2003.

I no longer have the project which caused the uncaught exception, I didn't keep it because it's not important to me. I need to use an ADXCommandBar, not an ADXOlExplorerCommandBar. If I have some time, I might create a new project with an ADXOlExplorerCommandBar and try to reproduce it and send it to you. But for now I am more concerned with my ADXCommandBar not uninstalling completely.

(I am sure if you just create a project with an ADXOlExplorerCommandBar and use it with an IMAP server, then click on the root of the IMAP store, this should throw the exception. Outlook displays a grey window normally, which contains the message "Unable to display the folder. This is the root of an IMAP store. The root does not contain messages..." whenever the root is clicked on.)
Posted 22 Apr, 2005 13:38:03 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Dom.

Thanks for the bug report. I will necessarily test ADX with an IMAP server and will let you know about results.
Why don't you use temporary command bars in your solution? The point is that you will probably experience some difficulties with the removing commnad bars from Outlook programatically. I mean if you have a password in Outlook you will have to enter the password whenever you are uninstalling the add-in. I tested this situation and found out that it is very annoying for the end user.
Posted 23 Apr, 2005 13:38:14 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Dom.

I have an example how to remove Outlook command bars programmatically when an add-in is being uninstalled.
Download here: http://www.add-in-express.com/projects/adxinstallevents.zip
Posted 27 Apr, 2005 11:38:01 Top
Dom




Posts: 5
Joined: 2005-04-22
Hi Sergey,

I am sorry for not getting back to you sooner. My attention was pulled away by another project. I have tested your fix and it works. This is what I have done:

- Created a project using the old ADX installation, adding an explorer toolbar
- Verified that the exception is thrown when I click on the root store of the IMAP server
- Uninstalled ADX.NET
- Installed the new ADX.NET
- Verified that the exception is no longer thrown.


Thanks for the quick response. Thanks also for the example code, I will look into this next.


Cheers,
Dom
Posted 28 Apr, 2005 13:15:15 Top
Dom




Posts: 5
Joined: 2005-04-22
Ok,

I've looked at the example provided by Sergey and it was most helpful. (Thanks again Sergey.)

However, it iterates through the Explorer and Inspector CommandBars and gets rid of those.

What I have tried to do from that example is to simply:

Outlook::_Application *olApp( 0);
Type *appObj = Type::GetTypeFromProgID( hostProgID, false);
olApp = __try_cast< Outlook::_Application *>( Activator::CreateInstance( appObj));

Array *dummy( 0);
(__try_cast<Extensibility::IDTExtensibility2 *>( this))->OnConnection( olApp, Extensibility::ext_ConnectMode::ext_cm_External, 0, &dummy);

olApp = __try_cast< Outlook::_Application *>( HostApplication);

if( olApp)
{
Outlook::_Explorer *olExp = olApp->ActiveExplorer( );
if( olExp)
{
Office::CommandBars *CmdBars = olExp->CommandBars;
if( CmdBars)
{
Office::CommandBar *OutlookAccessCmdBar = CmdBars->get_Item( S"Outlook Access Bar");
if( OutlookAccessCmdBar)
{
MessageBox::Show( S"Found command bar, deleting it next");
OutlookAccessCmdBar->Delete( );
MessageBox::Show( S"Deleted command bar");
}
else
{
MessageBox::Show( S"OutlookAccessCmdBar == 0");
}
}
else
{
MessageBox::Show( S"CmdBars == 0");
}
}
else
{
MessageBox::Show( S"olExp == 0");
}
}
else
{
MessageBox::Show( S"olApp == 0");
}



But what I find is that I can't use the ActiveExplorer to get the CommandBar pointer if the Outlook window isn't actually open. The OnConnection method does start the outlook.exe task as shown in the Windows Task Manager however.

So what do I have to do? Create a new explorer? What is the best way to get my CommandBar and delete it?

Any help is greatly appreciated by this newbie to Outlook programming.

Cheers.
Posted 05 May, 2005 17:07:57 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Dom.

You are right. The ActiveExplorer returns null if an Outlook instance is created in the code. I think the best way is to get the Outlook.Explorer object from the Outlook default folders.
For example:

Outlook.NameSpace session = application.Session;
Outlook.MAPIFolder folder = session.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
Outlook.Explorer explorer = folder.GetExplorer(Type.Missing);
Office.CommandBars commandbars = explorer.CommandBars;
...
// now we can iterate through the Explorer command bars.
Posted 06 May, 2005 13:43:47 Top