Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Use the Update method of the SubscriberDevice class to modify existing subscriber device data in the Notification Services instance database. The examples below show how to update a subscriber device 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 use a SubscriberDevice object in managed code to update a subscriber device.
string instanceName = "Tutorial";
// Create the NSInstance object.
NSInstance testInstance = new NSInstance(instanceName);
// Create the SubscriberDevice object.
SubscriberDevice testSubscriberDevice =
new SubscriberDevice(testInstance);
// Set the subscriber ID and device name
// so that the correct record is updated.
testSubscriberDevice.SubscriberId = "TestUser1";
testSubscriberDevice.DeviceName = "Work e-mail";
// Modify the subscriber device properties
// and update the record.
testSubscriberDevice.DeviceAddress = "[email protected]";
testSubscriberDevice.DeviceTypeName = "e-mail";
testSubscriberDevice.DeliveryChannelName = "FileChannel";
testSubscriberDevice.Update();
COM Interop Example
The following VBScript example shows how to use a SubscriberDevice object in unmanaged code to update a subscriber device:
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)
' Set the subscriber ID and device name
' so that the correct record is updated.
testSubscriberDevice.SubscriberId = "TestUser2"
testSubscriberDevice.DeviceName = "Work e-mail"
' Modify the subscriber device properties
' and update the record.
testSubscriberDevice.DeviceAddress = "[email protected]"
testSubscriberDevice.DeviceTypeName = "e-mail"
testSubscriberDevice.DeliveryChannelName = "FileChannel"
testSubscriberDevice.Update()
wscript.echo "Subscriber device updated."
See Also
Concepts
Creating a SubscriberDevice Object
Adding a Subscriber Device
Deleting a Subscriber Device
Populating a Delivery Channel List