This documentation is archived and is not being maintained.

NotificationServices Class

Represents a Notification Services server.

Namespace: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

public sealed class NotificationServices : NamedSmoObject
public final class NotificationServices extends NamedSmoObject
public final class NotificationServices extends NamedSmoObject

Updated text: 14 April 2006

Use the NotificationServices class to enumerate the Notification Services instances on an instance of the SQL Server 2005 Database Engine.

If you attempt to enumerate instances on a SQL Server 2000 instance, Notification Services throws an exception.

When using SQL Server Authentication to connect to a Notification Services instance via Notification Services Management Objects (NMO), you use a Server object to obtain a NotificationServices reference, and then use this reference to get a Notification Services instance. When creating an instance of the Server object, you can specify a ServerConnection object that uses a SqlConnection object.

If you are using SQL Server Authentication to call instance and application management methods such as Create, Update, Drop, Enable, or Disable, the SqlConnection must not already be open.

Make sure the SqlConnection is not opened before the Server object instance is created, or else use another ServerConnection constructor that does not use a SqlConnection object.


The following examples show how to use the Notification Services class to get information about instances of Notification Services:

// Specify the Database Engine instance that hosts the 
// Notificaiton Services instance and get a reference to 
// the NotificationServices object.
smo.Server server = new smo.Server("MyServer");
nmo.NotificationServices notificationServices = server.NotificationServices;

// Get the Notification Services instance.
nmo.Instance nsinst = notificationServices.Instances ["Tutorial"];

// Get the instance's collection of delivery channels.
nmo.DeliveryChannelCollection dcCollection = nsinst.DeliveryChannels;

// Enumerate the delivery channels.
foreach (nmo.DeliveryChannel dc in dcCollection)
{
    Console.WriteLine(dc.Name);
}

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

Release

History

14 April 2006

New content:
  • Added clarification that SqlConnection objects must not be open.

Show: