Free Support Forum - aspose.com

Weekly Recursive Meeting related properties in Aspose.Email

In the Outlook when we set a meeting as Recursive meeting, we have many options while sending it as weekly, daily, monthly, etc (as in screen shot)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

For a weekly recursive meeting, we can choose the days when the meetings will occur peridically.

How can we set these (checked days) properties for a meeting sent through Aspose.Email.Mail.Appointment

Note: We are using a Windows application in VB / Framework 3.5

Hi Deivarayan,


RecurrencePattern can be used to create weekly recurrence patterns. Could you please give a try to the following code which creates weekly patterns with selected days Monday, Tuesday, Wednesday.

Aspose.iCalendar.RecurrencePattern pattern = new Aspose.iCalendar.RecurrencePattern(“DTSTART:20130501T100000\n” + “RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO,TU,WE”);
DateCollection dates = pattern.GenerateOccurrences();

Please feel free to write us back if you have any other query related to Aspose.Email.


Hi,

Thanks for the reply.

But i get another error when i use the above code. PFA the error

Note: I am using the Aspose.Email version 2.8 in a Windows Application / Framework 3.5

Regards,

Deivarayan

Hi Deivarayan,


Could you please give a try to the following code which produces output given below:

Private Sub TestRecurrence()
Dim pattern As Aspose.iCalendar.RecurrencePattern = New Aspose.iCalendar.RecurrencePattern(“DTSTART:20130501T100000” & vbLf & “RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO,TU,WE”)
Dim dates As DateCollection = pattern.GenerateOccurrences()
For Each dt As Date In dates
Console.WriteLine(dt.ToLocalTime())
Next
End Sub

OUTPUT:

5/1/2013 3:00:00 PM
5/6/2013 3:00:00 PM
5/7/2013 3:00:00 PM
5/8/2013 3:00:00 PM
5/13/2013 3:00:00 PM
5/14/2013 3:00:00 PM
5/15/2013 3:00:00 PM
5/20/2013 3:00:00 PM
5/21/2013 3:00:00 PM
5/22/2013 3:00:00 PM

Please feel free to write us back if you have any query in this regard.

Hi Kashif,

We get the following error when we use the above approach.Value of type 'Aspose.iCalendar.RecurrencePattern' cannot be converted to 'Aspose.Email.Mail.Calendaring.RecurrencePattern'

Note: I am trying to send a weekly recursive meeting from SMTP Client as a mail.

PFB the sample code

Dim msg As MailMessage = New MailMessage()
msg.To.Add("XXXXXXXXX")
msg.From = New MailAddress("XXXXXXXXX")
Dim agendaAppointment As Appointment
agendaAppointment = New Appointment("same place", Date.Now, Date.Now.AddMinutes(10), msg.From, msg.To)
agendaAppointment.UniqueId = Guid.NewGuid().ToString()
agendaAppointment.Description = "----------------"
Dim pattern As Aspose.iCalendar.RecurrencePattern = New Aspose.iCalendar.RecurrencePattern("DTSTART:20130501T100000" & vbLf & "RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO,TU,WE")
Dim dates As DateCollection = pattern.GenerateOccurrences()
agendaAppointment.RecurrencePattern = pattern
msg.AlternateViews.Add(agendaAppointment.RequestApointment())
Dim smtp As SmtpClient = New SmtpClient("YYYYYYYYY")
smtp.Send(msg)

Regards,
Deivarayan

Hi Deivarayan,


Please accept our apology for delayed response.

Could you please give a try to the following code and provide us the feedback. Here Aspose.Email.Mail.Calendaring.WeeklyRecurrencePattern is used to create the recurrence and then assigned to the appointment.

Dim msg As New MailMessage()
msg.[To].Add("user1@gmail.com")
msg.From = New MailAddress("user2@gmail.com")
Dim agendaAppointment As Appointment = Nothing
agendaAppointment = New Appointment(“same place From VB .net”, System.DateTime.Now, System.DateTime.Now.AddMinutes(10), msg.From, msg.[To])
agendaAppointment.UniqueId = Guid.NewGuid().ToString()
agendaAppointment.Description = “----------------”
Dim pattern As New Aspose.Email.Mail.Calendaring.WeeklyRecurrencePattern(10)
pattern.StartDays = New Aspose.Email.Mail.Calendaring.CalendarDay(2) {}
pattern.StartDays(0) = Aspose.Email.Mail.Calendaring.CalendarDay.Monday
pattern.StartDays(1) = Aspose.Email.Mail.Calendaring.CalendarDay.Tuesday
pattern.StartDays(2) = Aspose.Email.Mail.Calendaring.CalendarDay.Wednesday
agendaAppointment.RecurrencePattern = pattern
msg.AlternateViews.Add(agendaAppointment.RequestApointment())
Dim smtp As SmtpClient = GetSmtpClient()
smtp.Send(msg)

Thanks a lot.

That solves my problem.

Regards,

Deivarayan

Hi Deivarayan,


We are glad to know that your issue is resolved. Please feel free to write us here if you have any other query related to Aspose.Email.