NotificationServices Class
Represents a Notification Services server.
Espace de noms: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
Syntaxe
'Déclaration
Public NotInheritable Class NotificationServices
Inherits NamedSmoObject
public sealed class NotificationServices : NamedSmoObject
public ref class NotificationServices sealed : public NamedSmoObject
public final class NotificationServices extends NamedSmoObject
public final class NotificationServices extends NamedSmoObject
Notes
Texte mis à jour :14 avril 2006
Use the NotificationServices class to enumerate the Notification Services instances on an instance of the SQL Server 2005 Moteur de base de données.
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.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.Management.Smo.SmoObjectBase
Microsoft.SqlServer.Management.Smo.SqlSmoObject
Microsoft.SqlServer.Management.Smo.NamedSmoObject
Microsoft.SqlServer.Management.Nmo.NotificationServices
Exemple
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);
}
' 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 Members
Microsoft.SqlServer.Management.Nmo Namespace
Server