Solved

Outlook 2010 folder count

Posted on 2014-03-07
5
4,875 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
  • 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 42

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Outlook Free & Paid Tools
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now