Office 2010 AutoExpand Imap Folders

Enable Macros

and then use this script

 

Private Sub Application_Startup()
ExpandAllIMAPAccounts
End Sub

Private Sub ExpandAllIMAPAccounts()
On Error GoTo On_Error

Dim session As Outlook.NameSpace
Dim report As String
Dim accounts As Outlook.accounts
Dim account As Outlook.account

Set session = Application.session
Set accounts = session.accounts

For Each account In accounts
If account.AccountType = Outlook.OlAccountType.olImap Then
FocusThisAccountInbox (account.DisplayName & "\Inbox")
End If
Next

Exiting:
Exit Sub
On_Error:
MsgBox "error=" & Err.Number & " " & Err.Description
Resume Exiting
End Sub

Private Function FocusThisAccountInbox(ByVal FolderPath As String)
On Error GoTo On_Error

Dim oFolder As Outlook.Folder
Dim FoldersArray As Variant
Dim SubFolders As Outlook.Folders

'Convert folderpath to array
FoldersArray = Split(FolderPath, "\")

'index 0 = account name
Set oFolder = Application.session.Folders.Item(FoldersArray(0))

Set SubFolders = oFolder.Folders

'index 1 = Inbox folder
Set oFolder = SubFolders.Item(FoldersArray(1))

Set Application.ActiveExplorer.CurrentFolder = oFolder
DoEvents
Exit Function

Exiting:
Exit Function
On_Error:
MsgBox "error=" & Err.Number & " " & Err.Description
Resume Exiting
End Function