NotificationServices.Instances Property

Gets the collection of Notification Services instances on the server.

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

Syntax

'Declaration
Public ReadOnly Property Instances As InstanceCollection
public InstanceCollection Instances { get; }
public:
property InstanceCollection^ Instances {
    InstanceCollection^ get ();
}
/** @property */
public InstanceCollection get_Instances ()
public function get Instances () : InstanceCollection

Property Value

An InstanceCollection object representing the collection of Notification Services instances on the server. Use the Create method to compile an instance of Notification Services and create the Notification Services instance and application database objects. Use the Repair method to repair instance metadata in the msdb system database. Notification Services uses this data to enumerate instances.

Remarks

The following examples show how to use the Instances property 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);
}
' Specify the Database Engine instance that hosts the 
' Notificaiton Services instance and get a reference to 
' the NotificationServices object.
Dim server As New smo.Server("nsuetest")
Dim notificationServices As nmo.NotificationServices = _
    server.NotificationServices

' Get the Notification Services instance.
Dim nsinst As nmo.Instance = _
    notificationServices.Instances("Tutorial")

' Get the instance's collection of delivery channels.
Dim dcCollection As nmo.DeliveryChannelCollection = _
    nsinst.DeliveryChannels

' Enumerate the delivery channels.
Dim dc As nmo.DeliveryChannel
For Each dc In dcCollection
    Console.WriteLine(dc.Name)
Next

Thread Safety

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.

Platforms

Development Platforms

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

Target Platforms

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

See Also

Reference

NotificationServices Class
NotificationServices Members
Microsoft.SqlServer.Management.Nmo Namespace