Checking for per item and changing menu accordingly

P

Poster

Hi,
I would like the Add-In monitor the Current Item and change the Menu
accordingly. Like if it is a contact, it will add the menu Send Mail
(If there is a valid email address), if it is a Task, it will add some
other menu.

These are the Menus on the Menu Bar of the Main Outlook Window, then the
menus on the Inspector Windows and the Context menu..

How can the Add-In detect all of this??

Kind Regards,

Jay
 
K

Ken Slovak - [MVP - Outlook]

Inspector.CurrentItem has the current item in that Inspector. If you trap
NewInspector you can get that. Then you can test for Item.Class = olMail or
whatever.

ActiveExplorer.Selection contains all the selected items in the active
Explorer. There is a SelectionChange event that can be trapped to tell when
the selection has changed. Be aware that more than 1 item can be selected so
you may want to iterate the Selection collection. Each item in the Selection
can be checked also for Class.

To detect when a user has selected a different folder for display you can
trap the BeforeFolderSwitch event in an Explorer and see what kind of folder
is being displayed. NewFolder (a MAPIFolder object) can be checked for
DefaultItemType or DefaultMessageClass to see what the folder is.

The context menus are a whole other thing and generally aren't available to
your code. There is a hack for that for Explorer context menus that sort of
works. You can look at the hack at
http://www.outlookcode.com/threads.aspx?forumid=4&messageid=3612
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top