Compartilhar via


IContentFormatter.FormatContent Method

Activates the content formatter to format notification data.

Namespace: Microsoft.SqlServer.NotificationServices
Assembly: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Syntax

'Declaration
Function FormatContent ( _
    subscriberLocale As String, _
    deviceTypeName As String, _
    recipientInfo As RecipientInfo, _
    rawContent As Hashtable() _
) As String
string FormatContent (
    string subscriberLocale,
    string deviceTypeName,
    RecipientInfo recipientInfo,
    Hashtable[] rawContent
)
String^ FormatContent (
    String^ subscriberLocale, 
    String^ deviceTypeName, 
    RecipientInfo^ recipientInfo, 
    array<Hashtable^>^ rawContent
)
String FormatContent (
    String subscriberLocale, 
    String deviceTypeName, 
    RecipientInfo recipientInfo, 
    Hashtable[] rawContent
)
function FormatContent (
    subscriberLocale : String, 
    deviceTypeName : String, 
    recipientInfo : RecipientInfo, 
    rawContent : Hashtable[]
) : String

Parameters

  • subscriberLocale
    A String which can be used to determine how the notification is formatted with regards to language, date/time/currency formatting, and so on. For more information about these codes, see Subscriber Locale Codes.
  • deviceTypeName
    A String providing the name that identifies the type of target device for this notification. The value of this string is specified in the subscriber device record of the target device for the notification. You can make use of this information in your content formatter processing, to format the notification to display appropriately on the recipient device.
  • recipientInfo
    A RecipientInfo object containing information about the subscriber who is to receive the notification. This information is composed of a subscriber ID and a device address.
  • rawContent
    An array of Hashtable objects containing the raw notification data. Each hash table represents a single notification, with entries for each notification and computed field. The array contains only one Hashtable object, unless digest delivery is used. If that is the case, there is one Hashtable object for each notification in the digest group.

Remarks

The distributor uses this method to pass raw notification data to the content formatter and have it generate formatted content. Your implementation of the FormatContent method should transform the raw data passed by the distributor into an appropriate formatted message for your application and return the formatted message as a string.

Your custom content formatter can internally use any technique to produce the formatted string. A simple approach might use basic string manipulation; more complex approaches might use XSL transforms or Microsoft ASP.NET rendering.

The FormatContent method provides a good place to implement filtering or encoding of notification content for security purposes. For example, as a security precaution, you might want to limit the total size of the notification content string produced.

Example

For an example of how to implement the FormatContent method, see the IContentFormatter interface topic.

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

IContentFormatter Interface
IContentFormatter Members
Microsoft.SqlServer.NotificationServices Namespace