FASTEST METHOD TO ENUMERATE FOLDERS

Status
Not open for further replies.

oliv-

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi,
Is there a faster method to enumerate all OUTLOOK FOLDERS and SUBFOLDERS ?
Perhaps DASL and Application.AdvancedSearch ?
I want to make a ".pickfolder" alternative.



Code:
Private Sub ListSubFolders()

    Dim OL As Outlook.Application
    Dim olNS As Outlook.NameSpace
    Dim objFolder As Outlook.Folders

    Set OL =Outlook.Application
    Set olNS = OL.GetNamespace("MAPI")

    Set objFolder = olNS.GetDefaultFolder(olFolderInbox).Parent
   call processFolder (objFolder)
End Sub


Sub ProcessFolder(StartFolder As Outlook.MAPIFolder)
    Dim objFolder As Outlook.MAPIFolder
    On Error Resume Next

    ' do something specific with this folder
    If StartFolder.DefaultItemType = olMailItem Then
     Debug.Print StartFolder.FolderPath
    End If
    ' process all the subfolders of this folder
    For Each objFolder In StartFolder.Folders
        Call ProcessFolder(objFolder)
    Next

    Set objFolder = Nothing
End Sub
 
For Outlook 2016 using a For i= loop is faster than For Each. I haven´t tested that in earlier versions. And for Outlook 2010 and older (not sure about 2013) using the RDOFolder object from Dmitry´s Redemption is way faster than the OOM.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
E Complite error on SaveAsFile method Outlook VBA and Custom Forms 2
Fozzie Bear Correct Method to set up Outlook.com accounts as Exchange Using Outlook.com accounts in Outlook 7
Diane Poremsky My Speedy CPAO Modification Method Using Outlook 0
N Get the seconds with userproperties.add method VBA Outlook Outlook VBA and Custom Forms 4
S Best method to use Outlook Standalone with iPhone Using Outlook 13
G run-time 438: object doesn't support this property or method Using Outlook 2
A Need method to rapidly correct telephone contact telephone number formatting Using Outlook 1
C MailItem Find method doesn't work Using Outlook 0
S Looking for client-side method (Outlook 2007/Exchange 2007) for users to delete Outlook VBA and Custom Forms 2
S Restrict method question on email. What am I doing wrong? Outlook VBA and Custom Forms 2
S MailItem Find Method question Outlook VBA and Custom Forms 6
A SmallScroll Method Outlook VBA and Custom Forms 1
D Call add-in method from macro? Outlook VBA and Custom Forms 1
P Question on getExchangeUser method in Outlook Add-in Outlook VBA and Custom Forms 3
P pasteface method crashing outlook Outlook VBA and Custom Forms 7
M Create email from Access on Outlook and make sure that email has beensent using WithEvents method Outlook VBA and Custom Forms 3
S Unable to enumerate Mailboxes in NON Cached Mode (if more than 2) Outlook VBA and Custom Forms 8

Similar threads

Back
Top