I'm trying to take a recurrence rule string that the scheduler put in my DB, and extract a list of dates from it. I found an example, but it doesn't work. rrule always returns null. Ultimately I just need a list of dates. Thanks
| //this was generated by the scheduler, and I coped it to here from the DB |
| string ruleString = "DTSTART:20100504T000000Z DTEND:20100505T000000Z RRULE:FREQ=WEEKLY;COUNT=2;INTERVAL=1;BYDAY=TU"; |
| RecurrenceRule rrule; |
| RecurrenceRule.TryParse(ruleString, out rrule); |
| if (rrule == null) |
| { |
| return; |
| } |
| DateTime test; |
| foreach (DateTime occurrence in rrule.Occurrences) |
| { |
| //do something with each date... |
| } |