Managing Subscriber Devices

The SubscriberDevice and SubscriberDeviceEnumeration classes support adding, updating, and deleting the target devices that subscribers use to receive notifications. These classes are provided by the Notification Services API, and can be found in the Microsoft.SqlServer.NotificationServices namespace.

A SubscriberDevice object represents a logical delivery endpoint for subscriptions. This object has properties for setting the device type, name, address, and subscriber. This information is usually passed to the object from a subscription management interface, and you then use the object to add, update, or remove the subscriber device record in the database.

You decide how many devices each subscriber can have, and how the DeviceName value is assigned. If you allow subscribers to have more than one device, you might want to let them pick their own device names. If you allow subscribers to have only one device, you might want to assign standard device names, based on the device type or some other criterion.

At the time of generating notifications, the notification generation rule must supply the subscriber device name to which the notification should be sent. Thus, the rule must have a way of determining which subscriber device name to use when generating a notification for a particular subscription. One way to do this is to store the subscriber device name associated with a subscription in the subscription data. Although including the subscriber device name in every subscription is common, it is not required. For example, there is no need to keep a device name in your subscriptions if your application always delivers notifications via e-mail and you use the subscriber's e-mail address as their subscriber ID. In this case you can simply pass a constant device name, such as "email device", when you generate a notification. Alternatively, you might decide not to include the subscriber's device name in a subscription because you always select the device name dynamically when you generate the notification.

Important

The device name entered into the notification record by the rule must correspond to the name of one of the subscriber's devices. If the device name provided in the notification record does not match a valid subscriber device record, then generator will write an error to the Windows Application log.

The SubscriberDeviceEnumeration class represents the set of subscriber devices for a given subscriber or Notification Services instance. You can select a specific subscriber device by supplying its device name to the indexer of a SubscriberDeviceEnumeration object.

In This Section

Topic Description

Creating a SubscriberDevice Object

Shows how to instantiate a subscriber device object.

Adding a Subscriber Device

Shows how to add a subscriber device to an instance of Notification Services.

Updating a Subscriber Device

Shows how to update an existing subscriber device record.

Deleting a Subscriber Device

Shows how to delete a subscriber device.

Populating a Delivery Channel List

Shows how to populate a list with delivery channels.

See Also

Concepts

Subscription Management API
Starting a Subscription Management Project

Other Resources

NSSubscriberDeviceView
Managing Subscriber Devices
Managing Subscription Data

Help and Information

Getting SQL Server 2005 Assistance