import com.moyosoft.exchange.*;
import com.moyosoft.exchange.contact.*;
import com.moyosoft.exchange.folder.*;
import com.moyosoft.exchange.item.*;
public class DisplayContacts
{
public static void main(String[] args) throws ExchangeServiceException
{
// To provide hostname and credentials information, use:
// Exchange exchange = new Exchange("hostname", "username", "password");
Exchange exchange = ExchangeConnectionDialog.display();
if(exchange == null)
{
return;
}
// Get the default Contacts folder
ExchangeFolder folder = exchange.getContactsFolder();
// Display all the contacts in the folder:
for(ExchangeItem item : folder.getItems())
{
ExchangeContact contact = (ExchangeContact) item;
System.out.println("First name: " + contact.getFirstName());
System.out.println("Last name: " + contact.getLastName());
System.out.println("Company: " + contact.getCompanyName());
System.out.println();
}
}
}