Trabajando con Elementos de Calendario en Exchange Server usando WebDav
Contents
[
Hide
]
Enviando Solicitudes de Reunión
Este artículo muestra cómo enviar una solicitud de reunión a múltiples destinatarios utilizando Microsoft Exchange Server y Aspose.Email.
- Crea una solicitud de reunión utilizando la clase Appointment y establece la ubicación, hora y asistentes.
- Crea una instancia de la clase MailMessage 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 clase ExchangeClient, que utiliza el protocolo WebDAV para conectarse al Exchange Server y puede ser utilizada con cualquier versión de Exchange Server en la que WebDAV esté habilitado, por ejemplo, Exchange 2000, 2003 o 2007. El siguiente fragmento de código te muestra cómo enviar la solicitud de reunión 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-.NET | |
try | |
{ | |
string mailboxUri = @"https://ex07sp1/exchange/administrator"; // WebDAV | |
string domain = @"litwareinc.com"; | |
string username = @"administrator"; | |
string password = @"Evaluation1"; | |
NetworkCredential credential = new NetworkCredential(username, password, domain); | |
Console.WriteLine("Connecting to Exchange server....."); | |
// Connect to Exchange Server | |
ExchangeClient client = new ExchangeClient(mailboxUri, credential); // WebDAV | |
// Create the meeting request | |
Appointment app = new Appointment("meeting request", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1.5), "administrator@" + domain, "bob@" + domain); | |
app.Summary = "meeting request summary"; | |
app.Description = "description"; | |
// Create the message and set the meeting request | |
MailMessage msg = new MailMessage(); | |
msg.From = "administrator@" + domain; | |
msg.To = "bob@" + domain; | |
msg.IsBodyHtml = true; | |
msg.HtmlBody = "<h3>HTML Heading</h3><p>Email Message detail</p>"; | |
msg.Subject = "meeting request"; | |
msg.AddAlternateView(app.RequestApointment(0)); | |
// Send the appointment | |
client.Send(msg); | |
Console.WriteLine("Appointment request sent"); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} |