Jaa


Creating a SubscriberDevice Object

Use the SubscriberDevice class to add, delete, and update subscriber device information in an instance of Notification Services. The examples below show how to create a SubscriberDevice object using managed code and using Microsoft Visual Basic Scripting Edition (VBScript) to illustrate COM interop.

Managed Code Example

The following code example shows how to create and initialize the SubscriberDevice object by using the parameterized constructor to pass in the name of the desired Notification Services instance. The SubscriberDevice object is usable immediately./

string instanceName = "Tutorial";

// Create the NSInstance object.
NSInstance testInstance = new NSInstance(instanceName);

// Create the SubscriberDevice object.
SubscriberDevice testSubscriberDevice = 
    new SubscriberDevice(testInstance);

COM Interop Example

The following VBScript example shows how to create and initialize the SubscriberDevice object via COM interop, by using the parameter-less constructor to create the object and then calling the Initialize method to initialize it:

Dim testInstance, testSubscriberDevice
const instanceName = "Tutorial"

' Create the NSInstance object.
set testInstance = _
    WScript.CreateObject( _
    "Microsoft.SqlServer.NotificationServices.NSInstance")
testInstance.Initialize instanceName

' Create the SubscriberDevice object.
set testSubscriberDevice = _
    WScript.CreateObject( _
    "Microsoft.SqlServer.NotificationServices.SubscriberDevice")
testSubscriberDevice.Initialize (testInstance)

See Also

Concepts

Adding a Subscriber Device
Updating a Subscriber Device
Deleting a Subscriber Device
Populating a Delivery Channel List

Help and Information

Getting SQL Server 2005 Assistance