0

I am using Icalendar to create a recurrence invite on a portal developed in C#. the body contains the information of rooms involved. If user creates a recurrence with 3 rooms for 5 week, a single invite for recurrence request got created. But if user updates rooms information for any specific day in that recurrence, I send a single invite for that day but to remove that day from single invite of recurrence, I have to recreate the the single invite for that 5 week with a specific days in EXDATE (exlusion). Is there a way i can achieve this to avoid recreation of the single invite for 5 week recurrence and a specific day is excluded from that invite.

sample of code i am using to create single invite for recurrence.

str.AppendLine("BEGIN:VCALENDAR");
str.AppendLine("PRODID:-//Team Test");
str.AppendLine("VERSION:2.0");
str.AppendLine("METHOD:REQUEST");
str.AppendLine("BEGIN:VEVENT");
str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", utcStime)); //utcStime is UTC time
str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", DateTime.UtcNow));
str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", utcEtime));////utcEtime is UTC time
str.AppendLine(string.Format("RRULE:FREQ=WEEKLY;COUNT=5"));
str.AppendLine("LOCATION:  ");
str.AppendLine(string.Format("UID:{0}", "Test12345"));
str.AppendLine(string.Format("DESCRIPTION:{0}", msg.Body));
str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", msg.Body));
str.AppendLine(string.Format("SUMMARY:{0}", msg.Subject));
str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", msg.From.Address));
for (int i = 0; i < msg.To.Count; i++)
{
    str.AppendLine(string.Format("ATTENDEE;ROLE=REQ-PARTICIPANT;CN=\"{0}\";RSVP=TRUE:mailto:{1}", msg.To[i].DisplayName, msg.To[i].Address));
}
str.AppendLine(string.Format("ATTENDEE;PARTSTAT=ACCEPTED;CN=\"{0}\":mailto:{1}",
str.AppendLine("BEGIN:VALARM");
str.AppendLine("TRIGGER:-PT15M");
str.AppendLine("ACTION:DISPLAY");
str.AppendLine("DESCRIPTION:Reminder");
str.AppendLine("END:VALARM");
str.AppendLine("END:VEVENT");
str.AppendLine("END:VCALENDAR");

System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
ct.Parameters.Add("method", "REQUEST");
AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
msg.AlternateViews.Add(avCal);
sc.Send(msg);  // sc is smtpclient i.e. SmtpClient sc = new SmtpClient();
Chandikumar
  • 139
  • 11
  • I guess, you should give more information. Some of your implementation of code. and introduction of ICalender. – Hiren Visavadiya Feb 23 '16 at 14:28
  • @DynamicVariable, I update my question with the sample code i am using to create single invite for the recurrence. – Chandikumar Feb 23 '16 at 14:37
  • The exclusion date is the correct way to do it in the ICalendar spec. – Bradley Uffner Feb 23 '16 at 14:39
  • @BradleyUffner, correct but the problem i am facing is user updates any specific day request and then i have to pass EXDATE and recreate recurrence invite and a new invite for that specific day, I have to avoid recreation of recurrence invite. – Chandikumar Feb 23 '16 at 14:58

1 Answers1

1

You do not have to create a separate event for this "exception". You simply resend your REQUEST (with a SEQUENCE property bumped by one) but it will contain 2 VEVENT components:

  • the master VEVENT component (with the RRULE, no EXDATE required)
  • an extra VEVENT component with a RECURRENCE-ID corresponding to the DTSTART of the instance that you want to modify.

See also Recurring events, how to store them? which gives pointers to examples.

Community
  • 1
  • 1
Arnaud Quillaud
  • 4,420
  • 1
  • 12
  • 8