Compartilhar via


Subscription.ScheduleRecurrence Property

Gets or sets the schedule recurrence information.

Namespace: Microsoft.SqlServer.NotificationServices
Assembly: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Syntax

'Declaration
Public Property ScheduleRecurrence As String
public string ScheduleRecurrence { get; set; }
public:
virtual property String^ ScheduleRecurrence {
    String^ get () sealed;
    void set (String^ value) sealed;
}
/** @property */
public final String get_ScheduleRecurrence ()

/** @property */
public final void set_ScheduleRecurrence (String value)
public final function get ScheduleRecurrence () : String

public final function set ScheduleRecurrence (value : String)

Property Value

A String containing schedule recurrence information.

Remarks

The ScheduleRecurrence property can be null if the ScheduleStart property is also null; otherwise ScheduleRecurrence must have a specified value. These properties are used together to assign a schedule to a subscription.

The value of the ScheduleRecurrence property must be in ICalendar format and use ICalendar recurrence rule syntax. All alphabetic characters in the ScheduleRecurrence property value must be in upper case.

A subscription with no timed rules (where the HasTimedRule property is false) does not permit values to be specified for the ScheduleStart and ScheduleRecurrence properties.

The ICalendar recurrence options are shown in the following table.

ICalendar Recurrence Options

FREQ=DAILY;

FREQ=WEEKLY;BYDAY=DaysOfWeekList;[BYMONTH=MonthsOfYearList;]

FREQ=MONTHLY;BYMONTHDAY=DaysOfMonthList;[BYMONTH=MonthsOfYearList;]

FREQ=YEARLY;BYMONTHDAY=DayOfMonth;BYMONTH=MonthOfYear;

The options that can be used to specify the schedule are:

  • DaysOfWeekList is [DayOfWeek | DayOfWeek,DaysOfWeekList]

    DayOfWeek is [MO | TU | WE | TH | FR | SA | SU]

  • DaysOfMonthList is [DayOfMonth | DayOfMonth,DaysOfMonthList]

    DayOfMonth is [1 | 2 | 3 | ... | 30 | 31]

  • MonthsOfYearList is [MonthOfYear | MonthOfYear,MonthsOfYearList]

    MonthOfYear is [1 | 2 | 3 | ... | 11 | 12]

For example, a valid ScheduleRecurrence value for recurrences on the first and last three months, for the first, eleventh, and fifteenth days of those months, would be FREQ=MONTHLY;BYMONTHDAY=1,11,15;BYMONTH=1,2,3,10,11,12.

Example

The following examples show how to use the ScheduleRecurrence property to set subscription schedule recurrence information:

' Set the recurrence of the subscription.
testSubscription.ScheduleRecurrence = "FREQ=DAILY"
 
' Set the start date and time of the subscription.
Dim scheduleBuilder As New StringBuilder()
scheduleBuilder.AppendFormat( _
    "TZID={0}:{1}{2}{3}T{4}{5}{6}", "4", _
    DateTime.Now.Year.ToString("D4"), _
    DateTime.Now.Month.ToString("D2"), _
    DateTime.Now.Day.ToString("D2"), _
    DateTime.Now.Hour.ToString("D2"), _
    DateTime.Now.Minute.ToString("D2"), _
    DateTime.Now.Second.ToString("D2"))
testSubscription.ScheduleStart = scheduleBuilder.ToString()
// Set the recurrence of the subscription.
testSubscription.ScheduleRecurrence = "FREQ=DAILY";

// Set the start date and time of the subscription.
StringBuilder scheduleBuilder = new StringBuilder();
scheduleBuilder.AppendFormat("TZID={0}:{1}{2}{3}T{4}{5}{6}",
    "4",
    DateTime.Now.Year.ToString("D4"),
    DateTime.Now.Month.ToString("D2"),
    DateTime.Now.Day.ToString("D2"),
    DateTime.Now.Hour.ToString("D2"),
    DateTime.Now.Minute.ToString("D2"),
    DateTime.Now.Second.ToString("D2"));
testSubscription.ScheduleStart = scheduleBuilder.ToString();

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace