ContentFormatter Constructor
Initializes a ContentFormatter object with a notification class and name.
命名空間: Microsoft.SqlServer.Management.Nmo
組件: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
語法
'宣告
Public Sub New ( _
ncParent As NotificationClass, _
name As String _
)
public ContentFormatter (
NotificationClass ncParent,
string name
)
public:
ContentFormatter (
NotificationClass^ ncParent,
String^ name
)
public ContentFormatter (
NotificationClass ncParent,
String name
)
public function ContentFormatter (
ncParent : NotificationClass,
name : String
)
參數
- ncParent
The NotificationClass for this content formatter.
name
A String that specifies the logical name of the content formatter.You cannot change the name. You must instead remove the content formatter and then add a content formatter with the new name.
範例
The following examples show how to create and define a content formatter object for the built-in XSLT content formatter:
// Add the XSLT content formatter to the notification class
ContentFormatter contentFormatter =
new ContentFormatter(flightNotifications, "XsltFormatter");
// Define content formatter arguments
ContentFormatterArgument contentFormatterArgument1 =
new ContentFormatterArgument(
contentFormatter, "XsltBaseDirectoryPath");
contentFormatterArgument1.Value = @"C:\NS\Full\XSLFiles";
ContentFormatterArgument contentFormatterArgument2 =
new ContentFormatterArgument(contentFormatter, "XsltFileName");
contentFormatterArgument2.Value = "NoOp.xslt";
// Add arguments to content formatter
contentFormatter.ContentFormatterArguments.Add(
contentFormatterArgument1);
contentFormatter.ContentFormatterArguments.Add(
contentFormatterArgument2);
// Assign the content formatter to the notification class
flightNotifications.ContentFormatter = contentFormatter;
' Add the XSLT content formatter to the notification class
Dim contentFormatter As ContentFormatter = _
New ContentFormatter(flightNotifications, "XsltFormatter")
' Define content formatter arguments
Dim contentFormatterArgument1 As ContentFormatterArgument = _
New ContentFormatterArgument(contentFormatter, _
"XsltBaseDirectoryPath")
contentFormatterArgument1.Value = "C:\NS\Full\XSLFiles"
Dim contentFormatterArgument2 As ContentFormatterArgument = _
New ContentFormatterArgument(contentFormatter, _
"XsltFileName")
contentFormatterArgument2.Value = "NoOp.xslt"
' Add arguments to content formatter
contentFormatter.ContentFormatterArguments.Add( _
contentFormatterArgument1)
contentFormatter.ContentFormatterArguments.Add( _
contentFormatterArgument2)
' Assign the content formatter to the notification class
flightNotifications.ContentFormatter = contentFormatter
平台
開發平台
如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。
目標平台
如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。
請參閱
參考
ContentFormatter Class
ContentFormatter Members
Microsoft.SqlServer.Management.Nmo Namespace