다음을 통해 공유


NotificationStatus Constructor (NotificationState, Boolean, String, String, Object)

Creates an instance of the NotificationStatus class, and initializes it with references to a NotificationState, a Boolean value indicating whether the delivery was a success, the delivery status, the notification text, and the delivery date and time. If specifying the notification delivery time, the value must be provided in Universal Time Coordinate (UTC) format.

네임스페이스: Microsoft.SqlServer.NotificationServices
어셈블리: Microsoft.SqlServer.NotificationServices (in 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
    A NotificationState object that contains notification information needed by the distributor to correctly interpret the delivery status information. The NotificationState object is passed to the delivery protocol in the DeliverNotification method as part of the NotificationHeaders object. The notificationState cannot be null.
  • succeeded
    A Boolean value that indicates whether the notification was successfully delivered. Can be null if not required.
  • statusInfo
    A String containing any additional notification status information. Can be null or a zero-length string if the delivery protocol has no additional status information to provide.
  • notificationText
    A String containing the formatted notification data that the delivery protocol tried to deliver. Can be null or a zero-length string if the value is not required.
  • timestamp
    An Object representing the time of the delivery attempt. Can be null if the delivery protocol cannot provide the full notification text.

The following examples show how to use a NotificationStatus object in a custom delivery protocol:

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