NotificationStatus クラスのインスタンスを作成し、NotificationState への参照、配信が成功したかどうかを示すブール値、配信ステータス、通知テキスト、および配信日時を使用して初期化します。通知の配信時刻の値を指定する場合には、世界協定時刻 (UTC) の書式で指定する必要があります。
名前空間: Microsoft.SqlServer.NotificationServices
アセンブリ: Microsoft.SqlServer.NotificationServices (microsoft.sqlserver.notificationservices.dll 内)
構文
'宣言
Public Sub New ( _
notificationState As NotificationState, _
succeeded As Boolean, _
statusInfo As String, _
notificationText As String, _
timestamp As Object _
)
public NotificationStatus (
NotificationState notificationState,
bool succeeded,
string statusInfo,
string notificationText,
Object timestamp
)
public:
NotificationStatus (
NotificationState^ notificationState,
bool succeeded,
String^ statusInfo,
String^ notificationText,
Object^ timestamp
)
public NotificationStatus (
NotificationState notificationState,
boolean succeeded,
String statusInfo,
String notificationText,
Object timestamp
)
public function NotificationStatus (
notificationState : NotificationState,
succeeded : boolean,
statusInfo : String,
notificationText : String,
timestamp : Object
)
パラメータ
- notificationState
配信状態情報をディストリビュータが正しく解釈するために必要な通知情報が格納されている NotificationState オブジェクトです。NotificationState オブジェクトは、DeliverNotification メソッドで NotificationHeaders オブジェクトの一部として配信プロトコルに渡されます。notificationState には NULL を使用できません。
- succeeded
通知が正常に配信されたかどうかを示すブール値です。必要ない場合は NULL を使用できます。
- statusInfo
追加の通知の状態情報を表す String です。配信プロトコルに追加の状態情報がない場合には、NULL または長さがゼロの文字列を使用できます。
- notificationText
配信プロトコルが配信しようとしたフォーマット済み通知データを表す String です。必要ない場合は、NULL または長さがゼロの文字列を使用できます。
- timestamp
配信が行われた時刻を表す Object です。配信プロトコルで通知テキストを完全に提供できない場合は、NULL を使用できます。
使用例
カスタム配信プロトコルで NotificationStatus オブジェクトを使用する例を次に示します。
private void SendStatus(
NotificationHeaders[] notificationHeaders,
bool successfulDelivery,
string body,
Exception failureException)
{
if (null != notificationStatusCallback)
{
ArrayList statusList = new ArrayList(
notificationHeaders.Length);
string statusInfo;
// Set some notification status parameters
// based on delivery success or failure.
string notificationText;
if (null == failureException)
{
statusInfo = "";
notificationText = "";
}
else
{
statusInfo = failureException.Message;
notificationText = body;
}
object timeStamp = DateTime.UtcNow;
// Create a NotificationStatus object for
// each notification and add it to an array.
for (int i = 0; i < notificationHeaders.Length; i++)
{
NotificationHeaders notificationHeader =
notificationHeaders[i];
statusList.Add(new NotificationStatus(
notificationHeader.NotificationState,
successfulDelivery, statusInfo,
notificationText, timeStamp));
}
// Pass the array of NotificationStatus objects
// to the NotificationStatusCallback delegate.
notificationStatusCallback(
(NotificationStatus[])statusList.ToArray(
typeof(NotificationStatus)));
}
}
プラットフォーム
開発プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
対象プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
参照
関連項目
NotificationStatus Class
NotificationStatus Members
Microsoft.SqlServer.NotificationServices Namespace