The GetMailboxTable method obtains information about all of the mailboxes on a server.
HRESULT GetMailboxTable(
LPTSTR lpszServerName, LPMAPITABLE FAR * lppTable, ULONG ulFlags);
Parameters
lpszServerName
Input parameter. Points to a string that contains the distinguished name (DN) of the server.
lppTable
Output parameter. Points to a MAPI IMAPITable interface containing the information about all of the mailboxes on the server specified in lpszServerName.
ulFlags
Input parameter. A defined value that specifies whether the server name is Unicode:
In addition, GetMailboxTable can return one of the following values:
SUCCESS_SUCCESS
The method completed successfully.
MAPI_E_CALL_FAILED
An unknown error occurred.
MAPI_E_INVALID_PARAMETER
One of the parameters was not valid.
MAPI_E_LOGON_FAILED
The Microsoft Exchange Server information store is not running on the server.
MAPI_E_NETWORK_ERROR
Cannot connect to the server.
MAPI_E_NO_ACCESS
The user has no permissions on the folder.
MAPI_E_NOT_ENOUGH_MEMORY
There wasn't enough memory to complete the operation.
Remarks
The GetMailboxTable method returns a pointer to a MAPI table whose rows represent each of the mailboxes on the server you specify in lpszServerName. The columns of this table give you information such as the mailbox name (in PR_DISPLAY_NAME), the sizes of each of the messages in the mailbox (in PR_MESSAGE_SIZE), and the total number of messages in the mailbox (in PR_ASSOC_CONTENT_COUNT).
The following properties are returned for each mailbox:
PR_DISPLAY_NAME
A MAPI property containing the name of the mailbox as displayed.
PR_EMAIL_ADDRESS
A MAPI property containing the e-mail address of the mailbox.