Recurrences Explained

In this article, you'll find detailed recurrence information, including data structure and example configuration.

Recurrence datastructure

  • DayNumber (int) - day of the month
  • DuringWeekday (int) - bitmask for week days
    • Sunday = 1,
    • Monday = 2,
    • Tuesday = 4,
    • Wednesday = 8,
    • Thursday = 16,
    • Friday = 32,
    • Every weekday = 62,
    • Saturday = 64,
    • Weekend days = 65,
    • Every day = 127
  • Month (int) - month of the year
  • WeekOfMonth (int) - number of week of month
    • First = 1,
    • Second = 2,
    • Third = 3,
    • Fourth = 4,
    • Last = 5
  • OccurenceCount (int) - number of occurrences before end
  • End (DateTime nullable) - recurrence end date (UTC)
  • RecurrenceID (Guid) - recurrence ID
  • RecurrenceType (int)
    • Daily = 0,
    • Weekly = 1,
    • Monthly = 2,
    • Yearly = 3,
    • Minutely = 4,
    • Hourly = 5
  • Repeat (int) - repeating periodicity
  • Range (int) - recurrence end range
    • NoEndDate = 0,
    • OccurenceCount = 1,
    • EndByDate = 2

Recurrence validation messages

  • "Enter recurrence week days." - Recurrence type is weekly and week days are not provided(DuringWeekday = 0)

  • "Enter recurrence months repeat." - Recurrence type is monthly and Repeat is 0. (Repeat every nth month with n = 0)

  • "Recurrence month is incorrect" - Recurrence type is yearly or monthly and Month is less than 1 or larger than 12

  • "Recurrence day number is incorrect" - Recurrence type is yearly or monthly and DayNumber is less than 1 or larger than 31

  • "Recurrence end time is incorrect" - Range is End by and End by is not provided or is in the past

  • "Recurrence occurrence count is incorrect" - Range is end after and occurrence count is not provided

  • "Recurrence Range is incorrect." - Range should be between 0 and 2

  • "Recurrence DuringWeekDay is incorrect." - Range should be between 0 and 127

  • "Recurrence DayNumber is incorrect." - Range should be between 1 and 31

  • "Recurrence Month is incorrect." - Range should be between 1 and 12

  • "Recurrence WeekOfMonth is incorrect." - Range should be between 0 and 5

  • "Recurrence Repeat is incorrect." - Raepeat should be 1 or greater

  • "Invalid day of week for a daily recurrence. Only WeekDays. EveryDay, WeekDays. WeekendDays and WeekDays. WorkDays are valid in this context."

    Scenario 1: Daily recurrence with every 3rd day repetition.

json
1
var recurrence =
2
{
3
DuringWeekday: 127,
4
Repeat: 3,
5
RecurreceType: 0,
6
DayNumber: 1,
7
Month: 1,
8
Range: 0 }

Scenario 2: Daily recurrence on week days (Monday - Friday) with no end date.

json
1
var recurrence = {
2
DuringWeekday: 62,
3
RecurreceType: 0
4
DayNumber: 1
5
Month: 1
6
Range: 0 }

Scenario 3: Monthly recurrence on 12th day on every 3rd month with end date 8/5/2015.

json
1
var recurrence = {
2
DuringWeekday: 1,
3
RecurreceType: 2,
4
DayNumber: 12,
5
Month: 1,
6
Range: 2,
7
End: Date(2014, 8, 5)
8
}

Scenario 4: Weekly recurrence on Tuesday and Wednesday end after 2 occurrences .

json
1
var recurrence = {
2
DuringWeekday: 12,
3
RecurreceType: 1,
4
DayNumber: 1,
5
Month: 1,
6
Range: 1,
7
8
OccurrenceCount: 1
9
}

Scenario 5: Yearly recurrence on every January 12th with no end date.

json
1
var recurrence = {
2
DuringWeekday: 1,
3
RecurreceType: 3,
4
WeekOfMonth: 0,
5
DayNumber: 12,
6
Month: 1,
7
Range: 0 }