N
Nate007
I've written a Com Add-In for Outlook in C#. The Add-In implments the
Extensibility.IDTExtensibility2 interface and is working nicely, but I cannot
remove the command buttons that I had added while testing the add-in.
I want to remove some CommandBarButtons from the main explorer window (the
standard 'Inbox' explorer that comes up in outlook by default). I've tried
this in both the OnDisconnection and OnBeginShutdown methods. The problem
that I'm encountering is that I can't get a reference to the Explorer object.
I've tried 2 different syntax to get the Explorer's reference:
object oActiveExplorer = this.oOutlook.ActiveExplorer();
and
object oActiveExplorer =
this.oOutlook.GetType().InvokeMember("ActiveExplorer",BindingFlags.GetProperty,null,this.oOutlook,null);
(this.oOutlook is an Outlook.Application reference to the Outlook app passed
in via the OnConnection method)
Both of these are returning null. Also, a check of the Explorers collection
showed that there were no members. I assume that this is because Outlook is
in the middle of closing at this point, and the explorer and other visual
components have been discarded already. Is this the case? If so, what is
the recommended way of cleaning up customized menus, etc?
I read about a property in Word called CustomizationContext or something to
that effect. This property tells Word where to save the customization (I
guess it would be which .dot file). I didn't see a similar type of thing in
Outlook. Did I miss it?
Perhaps Outlook is disposing of the COM Add-Ins asynchronously, so I can't
depend on a reference to the explorer being available?
Also, trying to remove them manually in Outlook doesn't work. They appear
on the list of menu items to customize, but they're dimmed out so you can't
edit them.
Anyway, I would appreciate anyone's input on this. Thanks in advance for
your help.
-Nate
Extensibility.IDTExtensibility2 interface and is working nicely, but I cannot
remove the command buttons that I had added while testing the add-in.
I want to remove some CommandBarButtons from the main explorer window (the
standard 'Inbox' explorer that comes up in outlook by default). I've tried
this in both the OnDisconnection and OnBeginShutdown methods. The problem
that I'm encountering is that I can't get a reference to the Explorer object.
I've tried 2 different syntax to get the Explorer's reference:
object oActiveExplorer = this.oOutlook.ActiveExplorer();
and
object oActiveExplorer =
this.oOutlook.GetType().InvokeMember("ActiveExplorer",BindingFlags.GetProperty,null,this.oOutlook,null);
(this.oOutlook is an Outlook.Application reference to the Outlook app passed
in via the OnConnection method)
Both of these are returning null. Also, a check of the Explorers collection
showed that there were no members. I assume that this is because Outlook is
in the middle of closing at this point, and the explorer and other visual
components have been discarded already. Is this the case? If so, what is
the recommended way of cleaning up customized menus, etc?
I read about a property in Word called CustomizationContext or something to
that effect. This property tells Word where to save the customization (I
guess it would be which .dot file). I didn't see a similar type of thing in
Outlook. Did I miss it?
Perhaps Outlook is disposing of the COM Add-Ins asynchronously, so I can't
depend on a reference to the explorer being available?
Also, trying to remove them manually in Outlook doesn't work. They appear
on the list of menu items to customize, but they're dimmed out so you can't
edit them.
Anyway, I would appreciate anyone's input on this. Thanks in advance for
your help.
-Nate