Solved

Outlook 2010 folder count

Posted on 2014-03-07
5
5,891 Views
Last Modified: 2014-03-31
Hi-

Is there a way to calculate the number of folders / sub-folders in an Outlook 2010, connecting to Exchange 2010 server?

Is there a limit beyond which to expect performance issues?
0
Comment
Question by:paullord
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 13

Accepted Solution

by:
Chris Raisin earned 500 total points
ID: 39914235
I have been advised by others (and I quote these statistics based on their advice) that early versions of the Exchange client supported 16,000 items per folder. However Outlook (with large table support enabled) supports about 65,000 items per folder. This is the default for new pst’s created ever since Outlook98.

Outlook 2003 with a Unicode format *.pst or *.ost can have an unlimited number of items.

In all cases these limits apply to all folder types. Especially note that subfolders count as ‘items’, so you could have 60000 folders and 5,000 messages, with each of the 60,000 folders containing 65,000 messages, at least until you hit the ANSI pst size limit of 2GB.

The good news is Exchange mailboxes are not affected by these limits, except when using them offline (so I'm told).

Be aware though that as your folders and mailbox grow Outlook WILL slow down, so, while you can have 65,000 contacts, it might be an idea to keep below that figure otherwise things may grind to a halt.

As far as calculating the number of folders you have, the following bit of code I have just written will probably help. Place it in your VBA editor then run the macros "CountFoldersInOutlook"
and "CountItemsInOutlook". I have not verified the numbers derived as being correct (but you may be able to tell from your results).

Public Sub CountFoldersInOutlook()

Dim outapp As Outlook.Application
Set outapp = CreateObject("Outlook.Application")
Dim olns As Outlook.NameSpace
Set olns = outapp.GetNamespace("MAPI")

MsgBox "Total Folders: " & GetSubFolderCount(olns.GetDefaultFolder(olFolderInbox).Parent)

End Sub

Private Function GetSubFolderCount(objParentFolder As MAPIFolder) As Long

Dim currentFolders As Folders
Dim fldCurrent As MAPIFolder

Set currentFolders = objParentFolder.Folders
If currentFolders.Count > 0 Then
   Set fldCurrent = currentFolders.GetFirst
   While Not fldCurrent Is Nothing
      TempFolderCount = TempFolderCount + GetSubFolderCount(fldCurrent)
      Set fldCurrent = currentFolders.GetNext
   Wend
   GetSubFolderCount = TempFolderCount + currentFolders.Count
Else
    GetSubFolderCount = 0
End If

End Function

Public Sub CountItemsInOutlook()

    Dim objOutlook As Object, objnSpace As Object, objFolder As MAPIFolder, objSubFolder As MAPIFolder
    
    Dim EmailCount As Integer
    Dim nFolder as Long, nFolders as Long, nSubFolders as Long, nSubFolder as Long
    Set objOutlook = CreateObject("Outlook.Application")
    Set objnSpace = objOutlook.GetNamespace("MAPI")

        nFolders = objnSpace.Folders.Count
        
        For nFolder = 1 To nFolders
          Set objFolder = objnSpace.Folders(nFolder)
          nSubFolders = objFolder.Folders.Count
          For nSubFolder = 1 To nSubFolders
            Set objSubFolder = objFolder.Folders(nSubFolder)
            nItems = nItems + objSubFolder.Items.Count
          Next
        Next
     

    EmailCount = nItems

    MsgBox "Total number of items (all folders) : " & CStr(nItems)
   
End Sub

Open in new window

0
 
LVL 43

Expert Comment

by:Davis McCarn
ID: 39914549
Or, right-click on the Personal Folders at the top of the folder tree, choose properties, then click the folder size button.
2010, BTW, is the first version that will compact the PST/OST automatically if left running in the background; but, users still need to empty their delete items and junk folders.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39914559
Sorry. I thought you were after code. My mistake.

Still it will be handy for those who DO want code! :-)
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39917425
I did however answer the second part of your question re limits. I hope the code comes in handy. :-)
Cheers
Chris (craisin) - Australia
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In-place Upgrading Dirsync to Azure AD Connect
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question