alex in a nutshell

December 19, 2011

Refreshing unread counts for IMAP folders in Outlook 2007 or 2010

Filed under: — Alex Salamakha @ 11:30 PM

I’ve got three Google Apps accounts with IMAP interface and I use Outlook to manage my emails.

It’s a great tool, but it has an annoying feature – when it starts it doesn’t display unread counts for IMAP accounts. So you have to physically click on every IMAP account to see whether you have any new messages or not. Pretty horrible, if you ask me.

Thankfully, it’s not that hard to solve this problem.

First of all, enable Developer tools:

Right-click Outlook toolbar, then choose Customize the Ribbon menu

then tick Developer toolbar:

You will now see Developer toolbar

Click on Macros button.

In the new window type GoThroughAllAccounts or whatever name you fancy and click Create button

In the editor window type

Sub GoThroughAllAccounts()
For Each Account In Session.Accounts
//iterate through accounts and go into each folder
Set Application.ActiveExplorer.CurrentFolder = Account.DeliveryStore.GetDefaultFolder(olFolderInbox)
End Sub

In the tree on the left click on Microsoft Outlook Object, choose ThisOutlookSession and double-click it. A new editor window will appear.

In the window choose Startup event from the drop-down on top-right and type

Call GoThroughAllAccounts

in the body of the sub-routine

Save your script and close the script editor.

Now we need to set permissions for your script to run on startup.

In Outlook click on File >> Options >> Trust Center and then press Trust Center settings button

Click on Macro Settings link on the left and choose one of the two options:

1) Notifications for all macros you will have to press Enable macros every time you start Outlook

2) Enable all macros – it will work without bothering you, but you have to be more cautious with this settings as you may end up getting viruses.

I use option 2).


Copyright © 1997-2017 Alexei Salamakha. All rights reserved
email:    Alex Salamakha on Facebook    Alex Salamakha on LinkedIn