Enviando solicitação de reunião com recorrência
Contents
[
Hide
]
Com Aspose.Email, é possível gerar uma solicitação de reunião com recorrência. Este artigo explica como uma solicitação de reunião pode ser gerada com uma recorrência específica. O Id Único do Compromisso pode ser salvo para uso posterior para enviar qualquer atualização ao compromisso.
Gerando solicitação de reunião com recorrência
O seguinte exemplo de código mostra como alcançar isso.
This file contains 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 | |
String szUniqueId; | |
// Create a mail message | |
MailMessage msg1 = new MailMessage(); | |
msg1.To.Add("to@domain.com"); | |
msg1.From = new MailAddress("from@gmail.com"); | |
// Create appointment object | |
Appointment agendaAppointment = default(Appointment); | |
// Fill appointment object | |
System.DateTime StartDate = new DateTime(2013, 12, 1, 17, 0, 0); | |
System.DateTime EndDate = new DateTime(2013, 12, 31, 17, 30, 0); | |
agendaAppointment = new Appointment("same place", StartDate, EndDate, msg1.From, msg1.To); | |
// Create unique id as it will help to access this appointment later | |
szUniqueId = Guid.NewGuid().ToString(); | |
agendaAppointment.UniqueId = szUniqueId; | |
agendaAppointment.Description = "----------------"; | |
// Create a weekly reccurence pattern object | |
WeeklyRecurrencePattern pattern1 = new WeeklyRecurrencePattern(14); | |
// Set weekly pattern properties like days: Mon, Tue and Thu | |
pattern1.StartDays = new CalendarDay[3]; | |
pattern1.StartDays[0] = CalendarDay.Monday; | |
pattern1.StartDays[1] = CalendarDay.Tuesday; | |
pattern1.StartDays[2] =CalendarDay.Thursday; | |
pattern1.Interval = 1; | |
// Set recurrence pattern for the appointment | |
agendaAppointment.Recurrence = pattern1; | |
//Attach this appointment with mail | |
msg1.AlternateViews.Add(agendaAppointment.RequestApointment()); | |
// Create SmtpCleint | |
SmtpClient client = new SmtpClient("smtp.gmail.com", 587, "your.email@gmail.com", "your.password"); | |
client.SecurityOptions = SecurityOptions.Auto; | |
// Send mail with appointment request | |
client.Send(msg1); | |
// Return unique id for later usage | |
// return szUniqueId; |
Enviar solicitação de atualização de compromisso
Para enviar uma atualização para um compromisso anterior, um id único é necessário. O código de exemplo a seguir mostra como essa solicitação de atualização de compromisso pode ser enviada
This file contains 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 | |
static public void EMAIL_UPDATE_RECURRENCE(String szUniqueId) | |
{ | |
System.DateTime StartDate = new DateTime(2013, 12, 12, 17, 0, 0); | |
System.DateTime EndDate = new DateTime(2013, 12, 12, 17, 30, 0); | |
Appointment appUpdate = new Appointment("Different Place", StartDate, | |
EndDate, "newcustomeronnet@gmail.com", "kashif.iqbal@aspose.com"); | |
appUpdate.UniqueId = szUniqueId; | |
WeeklyRecurrencePattern pattern3 = (WeeklyRecurrencePattern)appUpdate.Recurrence; | |
appUpdate.Summary = "update meeting request summary"; | |
appUpdate.Description = "update"; | |
MailMessage msgUpdate = new MailMessage("newcustomeronnet@gmail.com", "kashif.iqbal@aspose.com", "06 - test email - update meeting request", "test email"); | |
msgUpdate.AddAlternateView(appUpdate.UpdateAppointment()); | |
SmtpClient smtp = new SmtpClient("server.domain.com", 587, "username", "password"); | |
smtp.Send(msgUpdate); | |
} |