Fetch Messages from Exchange Server Mailbox using WebDav

Fetch Messages from an Exchange Server Mailbox

To fetch messages from Exchange Server Mailbox:

  1. Create an instance of type ExchangeClient.
  2. Specify the server name, user name, password, and domain.
  3. Call the listMessages method to get the ExchangeMessageInfoCollection.
  4. Loop through the ExchangeMessageInfoCollection collection to get ExchangeMessageInfo.getUniqueUri values.
  5. Call ExchangeClient.fetchMessage() and pass ExchangeMessageInfo.getUniqueUri as parameter.

The following code snippet connects to the Exchange Server mailbox and fetches all the messages.