Notification Services—Creating a Delivery Channel
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
Creating a Delivery Channel
A file delivery channel named StockWatchFileDeliveryChannel and an email delivery
channel named StockWatchEmailDeliveryChannel are created in the
CreateDeliveryChannel( ) method of Example 18-1. The code follows:
private static void CreateDeliveryChannel( ) { DeliveryChannelArgument dca; // add file delivery channel DeliveryChannel dcFile = new DeliveryChannel(nsi, "StockWatchFileDeliveryChannel"); dcFile.ProtocolName = "File"; dca = new DeliveryChannelArgument (dcFile, "FileName"); dca.Value = baseDirectoryPath + @"\Notifications\FileNotifications.txt"; dcFile.DeliveryChannelArguments.Add(dca); nsi.DeliveryChannels.Add(dcFile); Console.WriteLine("Added delivery channel: " + dcFile.Name); // add email delivery channel DeliveryChannel dcEmail = new DeliveryChannel(nsi, "StockWatchEmailDeliveryChannel"); dcEmail.ProtocolName = "SMTP"; nsi.DeliveryChannels.Add(dcEmail); Console.WriteLine("Added delivery channel: " + dcEmail.Name); }
You have to add at least one delivery channel to a Notification Services instance
before creating it. The ProtocolName property of the DeliveryChannel object must be
set to SMTP, File, or the name of a custom delivery protocol.
The NMO classes used to manage delivery channels are described in Table 18-3.
Table 18-3. NMO classes for managing delivery channels
| Delivery channel | Description |
DeliveryChannel
| Represents a delivery channel. |
DeliveryChannelArgument
| Represents a name-value pair specifying delivery channel configuration
and authentication information for the delivery service. |
DeliveryChannelArgumentCollection
| Represents a collection of delivery channel arguments as DeliveryChannelArgument objects. The DeliveryChannelArguments
property of the |
DeliveryChannelCollection
| Represents a collection of delivery channels as DeliveryChannel
objects. The |
|

