Sending Meeting Requests with Exchange Server using WebDav

Send Meeting Requests using Web Dav

To send a meeting request:

  1. Create a meeting request using the Appointment class and set the location, time and attendees.
  2. Create an instance of the MailMessage class and set the appointment using the MailMessage.addAlternateView() method.
  3. Connect to the Exchange Server and send the meeting request using the send(MailMessage) method.

This example uses the ExchangeClient class, which uses the WebDAV protocol to connect to the Exchange Server and can be used with any version of Exchange Server on which WebDAV is enabled, for example, Exchange 2000, 2003 or 2007.

The code snippets used to send the meeting request are given below:

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
try {
String domain = "litwareinc.com";
ExchangeClient client = new ExchangeClient("http://MachineName/exchange/Username", "username", "password", "domain");
// Create the meeting request
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date startDate = sdf.parse("10/05/2015 10:00:00");
Date endDate = sdf.parse("10/05/2015 10:30:00");
MailAddressCollection coll = new MailAddressCollection();
coll.add("bob@" + domain);
Appointment app = new Appointment("meeting request", startDate, endDate, new MailAddress("administrator@" + domain), coll);
app.setSummary("meeting request summary");
app.setDescription("description");
// Create the message and set the meeting request
MailMessage msg = new MailMessage();
msg.setFrom(new MailAddress("administrator@" + domain));
msg.setTo(coll);
msg.isBodyHtml(true);
msg.setHtmlBody("<h3>HTML Heading</h3><p>Email Message detail</p>");
msg.setSubject("meeting request");
msg.addAlternateView(app.requestApointment(0));
// Send the appointment
client.send(msg);
System.out.println("Appointment request sent");
} catch (ExchangeException ex) {
System.out.println(ex.getMessage());
}