Connecting to Exchange Server

Connect to Exchange Server using Exchange Web Service (EWS)

The following code sample shows how to connect to Exchange Server using EWS.

Connect to an Exchange Server using IMAP

First, make sure that IMAP services are enabled for your Exchange Server:

  1. Open the Control Panel.
  2. Go to Administrator Tools, then Services.
  3. Check the status of the Microsoft Exchange IMAP4 service.
  4. If it is not already running, enable/start it.

Below is the sample source code to connect and list messages from the Inbox folder of Microsoft Exchange Server using the IMAP protocol.

Programming Sample - Saving One Message Only

After connecting to an Exchange server using IMAP and getting the IMapMessageInfoCollection, you can use the MessageInfo object’s sequence number to save a specific message as follow: