Share via


NotificationClassProtocol.ProtocolFields Property

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

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

Syntax

'Declaration
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

Property Value

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

Remarks

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.

Example

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.

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

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

Other Resources

Fields Element for Protocol (ADF)
Configuring Delivery Protocols