Partager via


NotificationServices.Instances Property

Gets the collection of Notification Services instances on the server.

Espace de noms: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntaxe

'Déclaration
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

Valeur de propriété

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.

Notes

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

Sécurité des threads

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.

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

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