Outlook Developer Home
Outlook Programmer's Library
 
Outlook Technologies
Outlook Forms
Languages
Samples
Other Technologies

 

 

To clear the Outlook envelope icon from the Windows system tray

A common issue for people who subscribe to many mailing lists or use Net Folders to share data is controlling when Outlook puts an envelope in the system tray in the right side of the Windows task bar. Typically, they want to see the envelope icon only when they have new mail in the Inbox that is not from one of those lists and not part of a Net Folders transmission.

Since the envelope goes away after a user opens the latest items, you might think that setting the Unread property on those lower priority items to False would be enough to do the job. However, it doesn't suffice. Even if you use code or a Rules Wizard rule to mark items as Read, the envelope icon persists.

The icon placed in the system tray is governed by hidden window that developers don't have direct access to via the Outlook Object Model or Collaboration Data Objects. Therefore, you need to go outside Outlook for a solution. Outlook MVP Neo  has come up with an Outlook VBA technique that uses Windows API calls to remove the icon from the system tray. You can copy and paste the code below to your project or download the clear_icon.txt file.

One application of the RemoveNewMailIcon subroutine might be to run some code when the Application.NewMail event fires to see if any "interesting" new items have actually come in -- "interesting" here meaning items for which you want to see the envelope in the system tray. If not, call the RemoveNewMailIcon subroutine to clear the icon:

It turns out that integrating Neo's code into Outlook events isn't as straightforward as you might like. A discussion in the microsoft.public.outlook.program_vba newsgroup uncovered some apparent timing issues.

Code Sample

Back to Top

More Information

AutoRead for Outlook -- Custom action for Rules Wizard to mark messages that meet certain criteria as read and suppress the new mail indicator in the system tray.

   
2002-7 TurtleFlock, LLC
All right reserved.
About OutlookCode.com

Send comments to webmaster@outlookcode.com

Designed and Implemented by TerraLink USA 

FrontPage Integration
by RobsonDesignWorks

 
 
get Sue's code | forums | share your own code | registration