i am trying to load the appointments thru an xml file, the xml file is generated dynamically and its displaying all the appointments. however the recurrence and the enddate time does not seem to work correctly, i have attached the xml for your reference please take a look and let me know what am i missing?
The Problem:
if the start time is 10:00AM and the end time is 11:00AM and the start date is 10/25/2010 and the end date is 10/30/2010, the recurrence rule is not stopping on the end date, but continues infinetely. if i want an event to span 6 days continously from say 10/25 - 10/30 at 10:00AM to 11:00AM
what should be value of
<Start> tag?
<End> tag?
<RecurrenceRule>DTSTART:?
<RecurrenceRule>DTEND:?
<RecurrenceRule>UNTIL:?
<?
xml version="1.0" encoding="utf-8"?><Appointments><Resources><Resource><Key>1</Key><Text>Classes</Text></Resource><Resource><Key>2</Key><Text>Workshops</Text></Resource><Resource><Key>3</Key><Text>Salon Series</Text></Resource><Resource><Key>4</Key><Text>Teachers Symposium</Text></Resource><Resource><Key>5</Key><Text>Kids Art Camp</Text></Resource><Resource><Key>6</Key><Text>Teen Art Camp</Text></Resource><Resource><Key>7</Key><Text>Portfolio Development</Text></Resource><Resource><Key>8</Key><Text>Spring Break Art Camp</Text></Resource><Resource><Key>9</Key><Text>Summer Saturday Art Camp</Text></Resource><Resource><Key>10</Key><Text>Exhibitions</Text></Resource><Resource><Key>11</Key><Text>Events</Text></Resource><Resource><Key>12</Key><Text>Alerts</Text></Resource></Resources><Appointment><ID>1</ID><Subject>Test Event</Subject><Description>some Description<br/><a href='http://www.google.com'>Click here for more details</a></Description><Start>2010-09-25T11:30Z</Start><End>2010-09-26T14:00Z</End><RecurrenceRule>
<
![CDATA[
DTSTART:20100925T113000Z
DTEND:20100925T140000Z
RRULE:FREQ=DAILY;UNTIL:20100926T140000Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU]]
>
</
RecurrenceRule><Resources><Resource Key="4" /></Resources></Appointment><Appointment><ID>2</ID><Subject>Sunday Event</Subject><Description>sample event</Description><Start>2010-09-26T10:00Z</Start><End>2010-09-26T11:00Z</End><RecurrenceRule>
<
![CDATA[
DTSTART:20100926T100000Z
DTEND:20100926T110000Z
RRULE:FREQ=DAILY;UNTIL:20100926T110000Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU]]
>
</
RecurrenceRule><Resources><Resource Key="12" /></Resources></Appointment><Appointment><ID>3</ID><Subject>Special Event</Subject><Description>some description</Description><Start>2010-09-28T15:00Z</Start><End>2010-09-28T19:30Z</End><RecurrenceRule>
<
![CDATA[
DTSTART:20100928T150000Z
DTEND:20100928T193000Z
RRULE:FREQ=DAILY;UNTIL:20100928T193000Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU]]
>
</
RecurrenceRule><Resources><Resource Key="10" /></Resources></Appointment><Appointment><ID>4</ID><Subject>testing recurrence</Subject><Description>testing recurrence</Description><Start>2010-10-18T10:30Z</Start><End>2010-10-30T12:45Z</End><RecurrenceRule>
<
![CDATA[
DTSTART:20101018T103000Z
DTEND:20101018T124500Z
RRULE:FREQ=DAILY;UNTIL:20101030T124500Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU]]
>
</
RecurrenceRule><Resources><Resource Key="12" /></Resources></Appointment><Appointment><ID>5</ID><Subject>second event</Subject><Description>second event</Description><Start>2010-10-25T10:00Z</Start><End>2010-10-29T11:15Z</End><RecurrenceRule>
<
![CDATA[
DTSTART:20101025T100000Z
DTEND:20101025T111500Z
RRULE:FREQ=DAILY;UNTIL:20101029T111500Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU]]
>
</
RecurrenceRule><Resources><Resource Key="11" /></Resources></Appointment></Appointments>
here is the function that builds the recurrence string
public static string GetRecurranceString(DateTime StartDate, DateTime EndDate, string StartTime,string EndTime)
{
StringBuilder sb = new StringBuilder();
StringBuilder RecStr = new StringBuilder();
RecStr.Append(
"\r\n<![CDATA[");
sb.Append(StartDate.Month.ToString()).Append(
"/");
sb.Append(StartDate.Day.ToString()).Append(
"/");
sb.Append(StartDate.Year.ToString()).Append(
" ");
sb.Append(StartTime.Replace(
"AM", ":00 AM").Replace("PM", ":00 PM"));
DateTime mystartdate = Convert.ToDateTime(sb.ToString());
RecStr.Append(
"\r\nDTSTART:" + mystartdate.ToString("yyyyMMddTHHmm00Z"));
StringBuilder eb = new StringBuilder();
eb.Append(StartDate.Month.ToString()).Append(
"/");
eb.Append(StartDate.Day.ToString()).Append(
"/");
eb.Append(StartDate.Year.ToString()).Append(
" ");
eb.Append(EndTime.Replace(
"AM", ":00 AM").Replace("PM", ":00 PM"));
DateTime myenddate = Convert.ToDateTime(eb.ToString());
StringBuilder until = new StringBuilder();
until.Append(EndDate.Month.ToString()).Append(
"/");
until.Append(EndDate.Day.ToString()).Append(
"/");
until.Append(EndDate.Year.ToString()).Append(
" ");
until.Append(EndTime.Replace(
"AM", ":00 AM").Replace("PM", ":00 PM"));
DateTime myuntildate = Convert.ToDateTime(until.ToString());
RecStr.Append(
"\r\nDTEND:" + myenddate.ToString("yyyyMMddTHHmm00Z"));
RecStr.Append(
"\r\nRRULE:FREQ=DAILY;").Append("UNTIL:" + myuntildate.ToString("yyyyMMddTHHmm00Z")).Append(";INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU");
RecStr.Append(
"]]>\r\n");
return RecStr.ToString();
}