I have been using a single recurrence pattern by:
1) Creating an event
2) Adding a recurrence: i.e. .RecurrenceRules.Add(pattern);
3) Calling GetOccurences
If I want to apply multiple recurrence patterns (over days, weeks) it seems
the start and end date are properties of the event not the recurrence pattern.
In my data I have start and end dates as properties of the recurrence. How do
I make this compatible? Do I create multiple events with each have just one
pattern so I can specify the start and end times.
Then what do I call to get the occurrence output?
I'm not sure I fully understand what you're asking, but I'll try to give an
It sounds like rather than a recurrence pattern, you're wanting to specify
recurrence dates. A pattern is something like "every day for 6 weeks". Using
recurrence dates, you'd specify something like "Recurs on 10/5/2010,
10/6/2010, and 10/7/2010".
To use recurrence dates, you'd do something like the following:
IICalendar calendar = new iCalendar();
IEvent evt = calendar.Create<Event>();
IPeriodList times = new PeriodList();
times.Add(new iCalDateTime(2010, 10, 1));
This should be a bit simpler in the future, but for now, it should work.
Note that since you have both start/end times in your current data, you could
do this instead:
times.Add(new Period(startTime, endTime));
Let's say for example I have a recurrence of every 2nd monday of the month
from 1-1-2010 to 1-1-2020. Then I have a different recurrence of every Tuesday
of the week from 1-1-2015 to 1-1-2019. So where would I specify these
dates:1-1-2010 to 1-1-2020 and 1-1-2015 to 1-1-2019. Since as in my original
post, it seems the event only allows 1 date window. Thanks.
You'd either need to use the RecurrenceDates collection to add every date/time
the event recurs, or you'd need to split your event into two Event objects,
one for "every 2nd monday of the month from 1-1-2010 to 1-1-2020", and one for
"every Tuesday of the week from 1-1-2015 to 1-1-2019".
Thanks Doug. Seems obvious now that you mention it. LOL.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.