Enviando Solicitudes de Reunión con Exchange Server usando WebDav
Contents
[
Hide
]
Este artículo muestra cómo enviar una solicitud de reunión a múltiples destinatarios utilizando Microsoft Exchange Server y Aspose.Email. También explica cómo ajustar el código para trabajar con Exchange Web Services.
Enviar Solicitudes de Reunión usando Web Dav
Para enviar una solicitud de reunión:
- Crea una solicitud de reunión utilizando la Appointment clase y establece la ubicación, hora y asistentes.
- Crea una instancia de la MailMessage clase y establece la cita utilizando el método MailMessage.addAlternateView().
- Conéctate al Exchange Server y envía la solicitud de reunión utilizando el método send(MailMessage).
Este ejemplo utiliza la ExchangeClient clase, que utiliza el protocolo WebDAV para conectarse al Exchange Server y puede usarse con cualquier versión de Exchange Server en la que WebDAV esté habilitado, por ejemplo, Exchange 2000, 2003 o 2007.
Los fragmentos de código utilizados para enviar la solicitud de reunión se dan a continuación:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()); | |
} |