You have HOW MANY mailboxes?
Published Nov 08 2004 10:21 AM 753 Views

Once you’ve got the new edkmdb.h, you can take advantage of some new interfaces we’ve introduced: IExchangeManageStore3 and IExchangeManageStore4. First, some background.

 

IExchangeManageStore is a useful interface for managing an Exchange server from MAPI. Two important functions in this interface are GetMailboxTable and GetPublicFolderTable. GetMailboxTable returns a MAPI table with information on all the mailboxes which exist on the target Exchange server. GetPublicFolderTable does the same for Public Folders.

 

The functions exposed by the new interfaces do the exact same thing. So why do we need them? Remember that the functions return MAPI tables. There’s a design limitation to the number of rows that the Exchange MAPI provider can return in a table – 65,536 (64k) rows. This presents a problem when attempting to use these interfaces against truly massive servers.

 

The Exchange System Manager in Exchange 2000 hit this limit for both mailboxes and Public Folders. In each case, we made two fixes:

 

  • Fix the original API so it will return the maximum number of entries and not return an error (they used to return MAPI_E_TABLE_TOO_BIG). This allows apps using the original API to still ‘limp by’
  • Introduce the new API which takes an offset.

All of the fixes made it into Exchange 2003 in time for RTM.

 

The new interfaces will return a maximum of 64k entries starting at the offset you specify. They don’t return an error if there are more entries available. Instead, you simply increase your offset and make the call again – as soon as you get an empty table back, you know you’ve gotten all the entries. The API is really simple to use and incorporating it into existing code only required a few minor changes.

 

There is already an article in the Knowledge Base which shows how to use GetMailboxTable. I started to update the code in the article to use the new API and ended up writing a new sample, which I’ve shared out here.

- Stephen Griffin

3 Comments
Version history
Last update:
‎Jul 01 2019 03:01 PM
Updated by: