richard lin
Posts: 25
Joined: 2008-09-25
|
I have found that Outlook will cache the last state of its command bars and menu in its explorer.
I have a function to disable some of the outlook standard commandbars under certain context. The program can disable the standard menu bars. But once the add-in is unregistered, and restart the outlook, the outlook will keep the last states for those standard buttons. The net effect is that some of the menu or command bar might be disabled unless I remove the outlook folder under "C:\Documents and Settings\[logonid]\Application Data\Microsoft\Outlook".
Is there anyway to avoid this problem? My code is attached as below:
private void disableExplorerNonKDMUICompoments(Outlook.Explorer explorer)
{
CommandBar standardBar = explorer.CommandBars["Standard"];
if (standardBar==null)
throw new ApplicationException("Unable to get the standardbar object ");
for (int i=1;i<standardBar.Controls.Count;i++)
{
if (standardBar.Controls[i].Id==1874 )
{
// disable button new
standardBar.Controls[i].Enabled=false;
}
}
} |
|
Eugene Astafiev
Guest
|
Hi Richard,
When do you run this sub?
Did you try to do the opposite action (enable buttons) ?
|
|