Partager via


Subscription.ScheduleRecurrence Property

Gets or sets the schedule recurrence information.

Espace de noms: Microsoft.SqlServer.NotificationServices
Assembly: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Syntaxe

'Déclaration
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)

Valeur de propriété

A String containing schedule recurrence information.

Notes

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.

Exemple

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();

Sécurité des threads

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.

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace