Solved

Outlook 2010 folder count

Posted on 2014-03-07
5
5,312 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 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exchange Powershell Help 3 34
Exchange 2007 3 35
A couple of SPECIFIC Outlook 2016 Archive questions 7 24
Exchange 2010 Removal from Domain 6 26
Find out what you should include to make the best professional email signature for your organization.
In this video we show how to create an Accepted Domain 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 >> Ac…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

777 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