Working with Contacts on Exchange Server using WebDav
Contents
[
Hide
]
Exchange Server accounts hold more than just email messages. As well as fetching, moving, sending and deleting email messages from Exchange Servers, Aspose.Email allows you to work with contacts. This article explains how to retrieve contact information from an Exchange Server directly. This article also shows how you can list contacts from the Contacts folder.
Getting Contacts from an Exchange Server
The ExchangeClient class’ ListContacts() method can be used to get contact information from an Exchange Server. ListContacts() method requires the URI of the Contacts folder, which can be easily got with the ExchangeMailboxInfo.ContactsUri property.
To get contacts from an Exchange Server:
- Initialize the ExchangeClient class with address and credentials.
- Get the Contacts folder’s URI with the ExchangeClient.MailboxInfo.ContactsUri property.
- Call the ListContacts() method. It returns an array of MapiContact.
- Do a foreach loop on the MapiContact array to read the contact information.
The following code snippet shows you how to use ExchangeClient class to read all contacts from an Exchange Server.