Getting Mailbox Information using WebDav Client

Get Mailbox Information from an Exchange Server

To get the Exchange Mailbox information:

  1. Create an instance of the ExchangeClient class.
  2. Specify the Exchange Server, username, password and domain in the ExchangeClient constructor.
  3. Call the ExchangeClient.getMailboxSize() method to get mailbox size.
  4. Call the ExchangeClient.getMailboxInfo method to get an instance of the ExchangeMailboxInfo class.
  5. Get the mailbox information using the ExchangeMailboxInfo class' different properties.

The sample codes below get Exchange mailbox information.

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// Create instance of ExchangeClient class by giving credentials
ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "Username", "password", "domain");
System.out.println("Mailbox size: " + client.getMailboxSize() + " bytes");
ExchangeMailboxInfo mailboxInfo = client.getMailboxInfo();
System.out.println("Mailbox URI: " + mailboxInfo.getMailboxUri());
System.out.println("Inbox folder URI: " + mailboxInfo.getInboxUri());
System.out.println("Sent Items URI: " + mailboxInfo.getSentItemsUri());
System.out.println("Drafts folder URI: " + mailboxInfo.getDraftsUri());