Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Events.RecurrenceRule.NewWithFrequency

Creates a new recurrence rule.

Component Version macOS Windows Linux Server iOS SDK
Events 6.2 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes
MBS( "Events.RecurrenceRule.NewWithFrequency"; Frequency; Interval; EKRecurrenceEnd { ; daysOfTheWeek; daysOfTheMonth; monthsOfTheYear; weeksOfTheYear; daysOfTheYear; setPositions } )   More

Parameters

Parameter Description Example Flags
Frequency The frequency.
Can be Yearly, Monthly, Daily or Weekly.
"Weekly"
Interval The interval to use.
Must be > 0
1
EKRecurrenceEnd The reference to the recurrence end.
Can be empty.
$RecurrenceEnd
daysOfTheWeek The days of the week list.
An list of EKRecurrenceDayOfWeek object identifiers. Valid for all recurrence types except daily. Ignored otherwise. Corresponds to the BYDAY value in the iCalendar specification.
Version 7.1 accepts here also week days, not just RecurrenceDayOfWeek IDs returned from Events.RecurrenceDayOfWeek.NewWithDayOfWeek.
Optional
daysOfTheMonth The days of the month.
An list of numbers ([+/-] 1 to 31). Negative numbers infer counting from the end of the month. For example, -1 means the last day of the month. Valid only for monthly recurrences. Ignored otherwise. Corresponds to the BYMONTHDAY value in the iCalendar specification.
Optional
monthsOfTheYear The list of months in the year.
An list of numbers (1 to 12). Valid only for yearly recurrences. Ignored otherwise. Corresponds to the BYMONTH value in the iCalendar specification.
Optional
weeksOfTheYear The list of weeks in the year.
An list of numbers ([+/1] 1 to 53). Negative numbers infer counting from the end of the year. For example, -1 means the last week of the year. Valid only for yearly recurrences. Ignored otherwise. Corresponds to the BYWEEKNO value in the iCalendar specification.
Optional
daysOfTheYear The days of the year.
An list of numbers ([+/1] 1 to 366). Negative numbers infer counting from the end of the year. For example, -1 means the last day of the year. Valid only for yearly recurrences. Ignored otherwise. Corresponds to the BYYEARDAY value in the iCalendar specification.
Optional
setPositions The list of set positions.
An list of numbers ([+/1] 1 to 366). Used at the end of recurrence computation to filter the list to the positions specified. Negative numbers indicate starting at the end, i.e. -1 indicates taking the last result of the set. Valid when daysOfTheWeek, daysOfTheMonth, monthsOfTheYear, weeksOfTheYear, or daysOfTheYear is passed. Ignored otherwise. Corresponds to the BYSETPOS value in the iCalendar specification.
Optional

Result

Returns OK or error.

Description

Creates a new recurrence rule.
This can be used to build any kind of recurrence rule. But be aware that certain combinations make no sense and will be ignored. For example, if you pass daysOfTheWeek for a daily recurrence, they will be ignored.

Examples

Create rule to repeat each year:

MBS( "Events.RecurrenceRule.NewWithFrequency"; "Yearly";"1" )

Create rule to repeat each week:

MBS( "Events.RecurrenceRule.NewWithFrequency"; "Weekly";"1"; ""; MBS( "Events.RecurrenceDayOfWeek.NewWithDayOfWeek"; 1) )

Create event in summer only:

MBS( "Events.RecurrenceRule.NewWithFrequency";
"Monthly"; // by mont
"1"; // every
""; // no end date
"";
"";
"4¶5¶6¶7¶8¶9¶10" ) // only this months

Every week Tuesday and Wednesday:

MBS( "Events.RecurrenceRule.NewWithFrequency"; "Weekly";"1"; ""; "3¶4" )

See also

Release notes

Blog Entries

This function checks for a license.

Created 10th March 2016, last changed 14th March 2017


Events.RecurrenceRule.MonthsOfTheYear - Events.RecurrenceRule.SetPositions