Guest
Guest
|
I'm writing an Outlook add-in that only works on emails, appointments, and tasks. Therefore, I only want my command bar to appear in explorers and inspectors for those items. I thought that setting the item types in my command bar buttons would do this, but it doesn't. My command bar always appears regardless of the type of explorer/inspector I'm in. What am I missing? Thanks. |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi.
I guess that you use the ADXCommandBar component to add a new command bar in Outlook. But in order to manage buttons in Outlook you should use the ADXOlExplorerCommandBar and ADXOlInspectorCommandBar components.
Use the ItemTypes property of these components to make them visible in Outlook explorers/inspectors. |
|
Guest
Guest
|
Sergey,
Thanks - that solved the problem. But there's still one glitch:
I created my adxOlExplorerCommandBar and configured it to appear only for Mail items, but it appears when Outlook Today is selected. This is in Outlook 2003. How can I fix this? Thanks. |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi.
It happens because Outlook Today is the same thing as the Personal Folders.
In this situation I would suggest two solutions:
1.You enumerate all folders in which you would like to show the
command bar in the FolderNames property of the ADXOlExplorerCommandBar
component
2. You can disable the command bar manually in the code.
E.g. you can use the code below in the ExplorerFolderSwitch event
handler of the addinmodule:
Outlook._Explorer exp = explorer as Outlook._Explorer;
if (exp.CurrentFolder.Name == "Personal Folders")
adxOlExplorerCommandBar1.Enabled = false;
|
|
Guest
Guest
|
Thanks Sergey. Through some trial and error I found a solution that works no matter what the folders are named:
try
{
outlook = (Outlook.Application) this.HostApplication;
Outlook.Explorer exp = outlook.ActiveExplorer();
// This operation throws an exception if Outlook Today is showing.
String s = exp.CurrentView.ToString();
}
catch (Exception e)
{
olMailExplorerCommandBar.Enabled = false;
} |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Ok, let me know if you face any other difficulties with Outlook. |
|