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
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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.
Thread starter Similar threads Forum Replies Date
E Complite error on SaveAsFile method Outlook VBA and Custom Forms 3
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 New Slipstick.com Articles 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 New Slipstick.com Articles 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
P Error: Object does not support this method Using Outlook 1
J Inability to receive e-mail through Outlook--my preferred method. May have been caused through Outlook Connector. Using Outlook 2
M Is there a reliable export/delete method in Exchange 2010 SP1 Exchange Server Administration 3
D Best Method to Merge two companies Exchange environments one is on Exchange 2007 and the other on Exchange 2010 Exchange Server Administration 2
M Method to migrate OE personal folders to Outlook PSTs? Using Outlook 2
S the server method "getlist" failed - owa Exchange Server Administration 6
D Is it possible (with some sort of add-in or any method) to have a task view that displays all tasks from all task lists. Using Outlook 4
R How to share distribution list by email in Outlook 2007? Method recommended by Microsoft Help does not work. Using Outlook 3
E Exchange 2010 ECP "the server method 'getlist' failed" Exchange Server Administration 5
S Looking for client-side method (Outlook 2007/Exchange 2007) for users to delete Outlook VBA and Custom Forms 2
S The server method 'GetList' failed. in OWA Exchange Server Administration 1
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 How to enumerate mailbox folders in other users' mailbox Exchange Server Administration 4
S Unable to enumerate Mailboxes in NON Cached Mode (if more than 2) Outlook VBA and Custom Forms 8
Similar threads




























Top