Condividi tramite


NotificationClassProtocol.ProtocolFields Property

Gets the collection of protocol header field definitions for the delivery protocol.

Spazio dei nomi: Microsoft.SqlServer.Management.Nmo
Assembly : Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Sintassi

'Dichiarazione
Public ReadOnly Property ProtocolFields As ProtocolFieldCollection
public ProtocolFieldCollection ProtocolFields { get; }
public:
property ProtocolFieldCollection^ ProtocolFields {
    ProtocolFieldCollection^ get ();
}
/** @property */
public ProtocolFieldCollection get_ProtocolFields ()
public function get ProtocolFields () : ProtocolFieldCollection

Valore proprietà

A ProtocolFieldCollection object that represents the protocol header fields for the delivery protocol.

Osservazioni

Header fields are technically optional, but may be required by specific delivery protocols. For example, the built-in Simple Mail Transfer Protocol (SMTP) delivery protocol requires Subject, From, and To fields.

If you update the fields, updating the application deletes and re-creates the notification class to which it corresponds. This includes dropping and re-creating the Microsoft SQL Server tables used by this notification class. Any data existing in the existing notification class tables is permanently deleted.

Esempio

The following examples show how add a protocol field that references a notification field. The field is added at a specific position in the protocol field collection:

ProtocolField fileProtocolField3 = 
    new ProtocolField(fileProtocol, "Price");
fileProtocolField3.FieldReference = "FormattedPrice";
fileProtocol.ProtocolFields.Add(fileProtocolField3, 1);
Dim fileProtocolField3 As ProtocolField = _
    New ProtocolField(fileProtocol, "Price")
fileProtocolField3.FieldReference = "FormattedPrice"
fileProtocol.ProtocolFields.Add(fileProtocolField3, 1)

The following examples show how add a protocol field that uses an expression to compute the value. The field is added to the end of the collection:

ProtocolField smtpProtocolField1 = 
    new ProtocolField(smtpProtocol, "Subject");
smtpProtocolField1.SqlExpression = 
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())";
smtpProtocol.ProtocolFields.Add(smtpProtocolField1);
Dim smtpProtocolField1 As ProtocolField = _
    New ProtocolField(smtpProtocol, "Subject")
smtpProtocolField1.SqlExpression = _
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())"
smtpProtocol.ProtocolFields.Add(smtpProtocolField1)

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.

Piattaforme

Piattaforme di sviluppo

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Piattaforme di destinazione

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Vedere anche

Riferimento

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

Altre risorse

Fields Element for Protocol (ADF)
Configurazione dei protocolli di recapito