ScheduledToastNotification.ScheduledToastNotification(XmlDocument, DateTime, TimeSpan, UInt32) constructor

Applies to Windows and Windows Phone

Creates and initializes a new instance of a recurring ScheduledToastNotification.


var scheduledToastNotification = new Windows.UI.Notifications.ScheduledToastNotification(content, deliveryTime, snoozeInterval, maximumSnoozeCount);



Type: XmlDocument

The XML that defines the toast notification content.


Type: Date [JavaScript] | System.DateTimeOffset [.NET] | Windows::Foundation::DateTime [C++]

The date and time that Windows should first display the toast notification. You must call AddToSchedule before this time.


Type: Number [JavaScript] | System.TimeSpan [.NET] | Windows::Foundation::TimeSpan [C++]

The amount of time between occurrences of the notification. To be valid, this value must be no less than 60 seconds and no more than 60 minutes.


Type: Number [JavaScript] | System.UInt32 [.NET] | uint32 [C++]

The maximum number of times to display this notification. Valid values range from 1 to 5.


This type of recurring scheduled toast notification is good for a snooze alarm-like functionality. For instance, the notification could be displayed every five minutes until the maximum snooze count is reached, unless the notification is explicitly removed from the schedule in response to a user action.

Important  The sender is responsible for removing the notification from the schedule once the user activates the notification through a touch or click. Failure to do so can see the notification recurring until the maximum snooze count is reached, even if the user has already dealt with it.

If you want to schedule long recurrence intervals like months or years, we recommend that you use individual scheduled toasts rather than this method. That will avoid timing errors caused by daylight savings time or leap years.

The following code shows a call to this method that displays a toast beginning at myData every five minutes for a maximum of three times.

new ScheduledToastNotification(toast1, myDate, 60000, 3)


The following example shows a toast notification scheduled to display in one hour, including the use of this constructor to create the notification, specifying a snooze interval of 60 seconds and a maximum of five times to show the notification.

var Notifications = Windows.UI.Notifications;
var currentTime = new Date();
var seconds = 60;
var dueTime = new Date(currentTime.getTime() + seconds * 60 * 1000);
var idNumber = Math.floor(Math.random() * 100000000);  // Generates a unique ID number for the notification.

// Set up the notification text.
var toastXml = Notifications.ToastNotificationManager.getTemplateContent(Notifications.ToastTemplateType.toastText02);
var strings = toastXml.getElementsByTagName("text");
strings[0].appendChild(toastXml.createTextNode(This is a scheduled toast notification));
strings[1].appendChild(toastXml.createTextNode("Received: " + dueTime.toLocaleTimeString()));

// Create the toast notification object.
var toast = new Notifications.ScheduledToastNotification(toastXml, dueTime, 60 * 1000, 5); = "Toast" + idNumber;

// Add to the schedule.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::UI::Notifications [C++]



See also

ScheduledToastNotification(XmlDocument, DateTime)
Scheduled notifications sample
Toast schema
Guidelines and checklist for scheduled notifications



© 2014 Microsoft