Setting the Repeat Rule

For an event to occur repetitively, such as a weekly progress meeting, you need to set a repeat rule. You can set the repeat frequency as daily, weekly, monthly by day (for example every Monday of first week), monthly by date (for example 25th of every month), yearly by day (for example every Monday of first week of October) and yearly by date, to a calendar entry.

A repeat rule can be set by passing a TCalRRule to CCalEntry::SetRRule(). TCalRRule allows you to set any of the following iCal properties:

  • FREQ (rule type)

  • DTSTART (start date)

  • UNTIL (end date)

  • COUNT (number of instances)

  • INTERVAL (interval between instances)

  • BYDAY

  • BYMONTHDAY

  • BYYEARDAY

  • WKST (start day of week)

You can set the repeat rule as follows:

// set the repeat definition type
TCalRRule rrule = TCalRRule(EWeekly);
// set interval between each instance 
rrule.SetInterval(1);
// set the start Time 
TCalTime startTime; 
startTime.SetTimeLocalL(TDateTime(2005, EJuly, 26, 0, 0, 0, 0)); 
rpt.SetDtStart(startTime); 
// set the end Time 
TCalTime endTime; 
endTime.SetTimeLocalL(TDateTime(2007, EAugust, 28, 14, 0, 0, 0)); 
rrule.SetUntil(endTime); 
// set the repeat rule in the calendar entry 
entry->SetRRuleL(rrule); 
// You can set the time zone rules for the entry’s repeat rules
entry->SetTzRulesL(*tzrule); // tzrule object is of CTzRules type