?
Solved

Outlook 2010 folder count

Posted on 2014-03-07
5
Medium Priority
?
6,195 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 2000 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

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.
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses
Course of the Month12 days, 7 hours left to enroll

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