Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print folder list/properties (Outlook 2K sr1/Exch 5.5 sp4)

    Good morning all. I have a user with approximately 150 folders in his nearly-2-GIG mailbox. I'd like to print a list of his folders/subfolders with the size of the folder. I know that I can view this information by looking at the mailbox properties/folder size window from Outlook, but I can't figure out a way to print this information.

    Is there a way to do this?

    Thanks in advance for your thoughts...

    klyjen

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Print folder list/properties (Outlook 2K sr1/Exch 5.5 sp4)

    This VBA routine should do roughly what you want:
    <pre>Function MAPIFolderSize(fdr As MAPI.Folder)
    Dim fdrSub As MAPI.Folder, itm As MAPI.Message
    For Each itm In fdr.Messages
    MAPIFolderSize = MAPIFolderSize + itm.Size
    Next
    Debug.Print fdr.Name & " : " & MAPIFolderSize
    If fdr.Folders.Count > 0 Then
    For Each fdrSub In fdr.Folders
    MAPIFolderSize fdrSub
    Next fdrSub
    Else
    End If
    End Function
    Sub ListAllFolders()
    Dim cdoSession As MAPI.Session, lngSize As Long
    Dim fdrMain As MAPI.Folder, fdr As MAPI.Folder
    Set cdoSession = New MAPI.Session
    cdoSession.Logon
    Set fdrMain = cdoSession.GetInfoStore.RootFolder
    For Each fdr In fdrMain.Folders
    lngSize = MAPIFolderSize(fdrMain)
    Next fdr
    Set fdrMain = Nothing
    End Sub
    </pre>

    You'll need a reference to the CDO object library for this to work. It's not 100% accurate on all folders - I suspect due to the presence of hidden messages - but seems fine on email folders.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print folder list/properties (Outlook 2K sr1/Exch 5.5 sp4)

    Thanks Rory...I'll give that a shot and see if I get what I need. I appreciate the code.

    klyjen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •