RecurrenceRecurMonthly(Int32, Int32) Method

Initialize a monthly recurrence pattern that occurs on a specific day of the month at the specified monthly interval.

Definition

Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2023.1.2.0
public void RecurMonthly(
	int day,
	int recurInterval
)

Parameters

day  Int32
The day of the month on which to occur
recurInterval  Int32
The interval between occurrences in months

Remarks

This is a convenience method that mimics the monthly recurrence pattern in Microsoft Outlook. When called, it sets up the recurrence for a monthly pattern that recurs at the specified interval on the specified day of the month. All rule parts are cleared prior to setting the monthly options but other parameters such as the start date are left alone.

Example

C#
// Test monthly recurrence
rRecur.RecurMonthly(15, 2);
rRecur.StartDateTime = DateTime.Today;
rRecur.RecurUntil = DateTime.Today.AddMonths(12);

// With a collection
DateTimeCollection recurDates = rRecur.InstancesBetween(DateTime.Today,
    DateTime.Today.AddMonths(12));

foreach(DateTime dt in recurDates)
    Console.WriteLine("Monthly recurrence on: {0:d}", dt);

// Using the enumerator
foreach(DateTime dt in rRecur)
    Console.WriteLine("Monthly recurrence on: {0:d}", dt);

// Test monthly recurrence
rRecur.RecurMonthly(DayOccurrence.Third, DaysOfWeek.Thursday, 3);
rRecur.StartDateTime = DateTime.Today;

// With a collection
Dim recurDates As DateTimeCollection = rRecur.InstancesBetween(DateTime.Today,
    DateTime.Today.AddMonths(12));

foreach(DateTime dt in recurDates)
    Console.WriteLine("Monthly recurrence on: {0:d}", dt);

// Using the enumerator
foreach(DateTime dt in rRecur)
    Console.WriteLine("Monthly recurrence on: {0:d}", dt);

Exceptions

ArgumentOutOfRangeExceptionAn exception will be thrown if the day value is not between 1 and 31.

See Also