RecipientStatus Property

RecipientStatus Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Each element of the RecipientStatus array indicates the type of message sent regarding the recipient specified in the corresponding array entry of the RecipientAddress property. The RecipientStatus property is read-only.

Applies To

The RecipientStatus property is a member of the Exchange_MessageTrackingEntry Class.

Instance Path

The RecipientStatus property appears on instances of the \\COMPUTERNAME\ROOT\MicrosoftExchangeV2:Exchange_MessageTrackingEntry class.

MOF Syntax

[read] uint32 RecipientStatus[];

Qualifiers

This property has no qualifiers.

Remarks

The number of elements in the RecipientStatus property array is also provided in the RecipientCount Property. Each element in the RecipientStatus array has a corresponding element in the array returned by the RecipientAddress Property.

The value of each element in the array returned by the RecipientStatus property indicates the delivery status for the corresponding recipient. The status values can be:

Value Name Value Description
Normal 0 Indicates that a normal e-mail message was sent to the recipient.
Non-Deliverable Response 1 Indicates that the log entry records transmission of an e-mail message notifying the sender there was a problem delivering the original message. The corresponding array element in the RecipientAddress Property indicates the recipient of the original message that encountered the delivery problem.
Delivery Receipt 2 Indicates that the log entry records transmission of an e-mail message notifying the sender that the original message was successfully delivered. The corresponding array element in the RecipientAddress Property indicates the recipient of the original message.
Read Receipt 3 Indicates that the log entry records transmission of an e-mail message notifying the sender that the original message has been read by the recipient. The corresponding array element in the RecipientAddress Property indicates the recipient who read the original message.

Selecting Instances Using VBScript

The following example shows how to retrieve a list of Exchange_MessageTrackingEntry instances, and the RecipientStatus property, using the ExecQuery method.

'===============================================================
' Name:      ShowExchange_MessageTrackingEntry_Query_RecipientStatus
' Purpose:   Display each Exchange_MessageTrackingEntry found for the
'            specified Exchange server, and show the Recipient
'            information for each Exchange_MessageTrackingEntry
'            instance.
' Input:     strComputerName [string] the computer to access
'            intHoursToShow [integer] the number of hours before the
'            present time for which log entries will be shown.
'            intUTCOffset [integer] Local time offset from UTC
' Output:    Displays the RecipientAddress and RecipientStatus of
'            each recipient for each Exchange_MessageTrackingEntry.
'
'===============================================================
' IMPORTANT: This script may take a very long time to execute when run
'            on a heavily used Exchange server, or when a very long
'            intHoursToShow is given. This script uses the ExecQuery
'            programming style, and gives a lower limit to the
'            TimeLogged property. It is recommended that applications
'            specify lower and upper bounds for the TimeLogged
'            property to improve performance.
'===============================================================
Public Sub ShowExchange_MessageTrackingEntry_Query_RecipientStatus ( _
  strComputerName, intHoursToShow, intUTCOffset )

Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_MessageTrackingEntry"

Dim strWinMgmts              ' Connection string for WMI
Dim objWMIExchange           ' Exchange Namespace WMI object
Dim listExchange_MessageTrackingEntries ' Exchange_MessageTrackingEntry
                             ' collection
Dim objExchange_MessageTrackingEntry ' An Exchange_MessageTrackingEntry
                             ' instance
Dim intRecipientIndex        ' A counter for the recipient and
                             ' recipient status arrays
Dim strWQLQuery              ' A string for the Query
Dim strQueryLanguage         ' A string for the Query Language
Dim dtListFrom               ' Date/Time start for log entry inclusion
Dim strStartDateTime         ' WMI time stamp for log entry inclusion

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer passed to the function in strComputerName, and
' using the CIM namespace for the Exchange_MessageTrackingEntry
' provider.
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//" & _
   strComputerName & "/" & cWMINameSpace
'
' Get an object using the string you just created.
Set objWMIExchange =  GetObject(strWinMgmts)
'
' Create a date in the string form expected by WMI.
' For example, 12 November 2001, 4:29:24 = 20011120042924.000000+000
' Time stamps in WMI are compared as strings, and the TimeLogged
' property is always given with zero offset from UTC.
'
' Get the UTC-adjusted log-entry cutoff time.
dtListFrom = DateAdd("h",(intHoursToShow - intUTCOffset),now)
'
' Initialize the time stamp string with the year.
strStartDateTime = year(dtListFrom)
' Add a leading zero for the month, if needed.
if (Month(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the month value to the string.
strStartDateTime = strStartDateTime & Month(dtListFrom)
' Add a leading zero for the day, if needed.
if (Day(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the day value to the string.
strStartDateTime = strStartDateTime & Day(dtListFrom)
' Add a leading zero for the hours, if needed.
if (Hour(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the hours value to the string.
strStartDateTime = strStartDateTime & Hour(dtListFrom)
' Add a leading zero for the minutes, if needed.
if (Minute(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the minutes value to the string.
strStartDateTime = strStartDateTime & Minute(dtListFrom)
' Add a leading zero for the seconds.
if (Second(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the seconds value to the string, the part for fractional
' seconds, and an empty UTC offset. The empty UTC offset is
' needed to match the offset used by the TimeLogged property.
strStartDateTime = strStartDateTime & Second(dtListFrom) & ".000000+000"
'
' Construct the WQL Query string. Note the double-quotes surrounding the
' previously constructed date string.
strWQLQuery = "SELECT RecipientCount, RecipientAddress, RecipientStatus " & _
    "FROM Exchange_MessageTrackingEntry " & _
    "WHERE TimeLogged > """ & strStartDateTime & """"

' Display the query string you just constructed.
WScript.echo "The query string to be used: "
WScript.echo "    " & strWQLQuery

' Set the WMI Query Language (WQL) indicator.
strQueryLanguage = "WQL"

' The instances are returned as a list of Exchange_MessageTrackingEntry
' instances in the Exchange namespace.
Set listExchange_MessageTrackingEntries = objWMIExchange.ExecQuery ( _
    strWQLQuery, strQueryLanguage)

' Indicate how many items were returned by the query.
WScript.echo "Number of items returned: " & _
    listExchange_MessageTrackingEntries.Count
'
' Iterate through the list of Exchange_MessageTrackingEntry objects.
For each objExchange_MessageTrackingEntry in _
   listExchange_MessageTrackingEntries
   '
   ' Display the value of the KeyID property.
   WScript.echo "KeyID = " & _
    "[" & TypeName(objExchange_MessageTrackingEntry.KeyID) & "] " & _
     objExchange_MessageTrackingEntry.KeyID
   '
   ' Display the value of the RecipientCount property.
   WScript.echo "    RecipientCount           = [" & _
     TypeName(objExchange_MessageTrackingEntry.RecipientCount) & "] " & _
    objExchange_MessageTrackingEntry.RecipientCount
   '
   ' Check whether there are any recipients listed.
   if (objExchange_MessageTrackingEntry.RecipientCount > 0) then
     ' If yes, then do the following:
     ' Display a heading.
     WScript.echo "        RecipientAddress : RecipientStatus"
     '
     ' Iterate through the recipient status arrays based on the
     ' number returned by RecipientCount.
     for intRecipientIndex = 0 to objExchange_MessageTrackingEntry.RecipientCount-1
       ' Display the value of the RecipientAddress and RecipientStatus properties.
       WScript.echo "        " & _
         objExchange_MessageTrackingEntry.RecipientAddress(intRecipientIndex) & _
         " : " & _
         objExchange_MessageTrackingEntry.RecipientStatus(intRecipientIndex)
       '
     ' Move to the next recipient.
     next
   else
     ' If no, indicate there no recipients listed.
     WScript.echo "    The RecipientAddress and RecipientStatus arrays were empty."
   end if
   '
   ' Move to the next Exchange_MessageTrackingEntry.
Next
end Sub

VBScript Example

The following example shows how to retrieve a list of Exchange_MessageTrackingEntry instances, and how to retrieve the RecipientStatus property.

'===============================================================
' Name:      ShowExchange_MessageTrackingEntry_RecipientStatus
' Purpose:   Display each Exchange_MessageTrackingEntry found for the
'            specified Exchange server, and show the RecipientAddress
'            and RecipientStatus properties for each
'            Exchange_MessageTrackingEntry instance.
' Input:     strComputerName [string] the computer to access
' Output:    Displays the KeyID of each Exchange_MessageTrackingEntry
'            and the RecipientAddress and RecipientStatus properties.
'
'===============================================================
' IMPORTANT: This script may take a very long time to execute when run
'            on a heavily used Exchange server, because the script
'            lists information about all message transfers recorded
'            in the message tracking logs. The GetInstances style
'            of access used in this script causes the WMI provider
'            to enumerate all log entries. To improve the performance
'            of scripts using Exchange_MessageTrackingEntry instances,
'            it is recommended you use WMI ExecQuery, and restrict
'            the results range with the TimeLogged property.
'===============================================================
Public Sub ShowExchange_MessageTrackingEntry_RecipientStatus ( strComputerName )

Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_MessageTrackingEntry"

Dim strWinMgmts              ' Connection string for WMI
Dim objWMIExchange           ' Exchange Namespace WMI object
Dim listExchange_MessageTrackingEntries ' Exchange_MessageTrackingEntry
                             ' collection
Dim objExchange_MessageTrackingEntry ' A single Exchange_MessageTrackingEntry
                             ' instance
Dim intRecipientIndex        ' A counter for the recipient and recipient
                             ' status arrays

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer passed to the function in strComputerName, and
' using the CIM namespace for the Exchange_MessageTrackingEntry provider.
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//" & _
   strComputerName & "/" & cWMINameSpace
'
' Get an object using the string you just created.
Set objWMIExchange =  GetObject(strWinMgmts)
'
' The instances appear as a list of Exchange_MessageTrackingEntry
' instances in the Exchange namespace.
Set listExchange_MessageTrackingEntries = objWMIExchange.InstancesOf(cWMIInstance)
'
' Iterate through the list of Exchange_MessageTrackingEntry objects.
For each objExchange_MessageTrackingEntry in listExchange_MessageTrackingEntries
   '
   ' Display the value of the KeyID property.
   WScript.echo "KeyID = " & _
    "[" & TypeName(objExchange_MessageTrackingEntry.KeyID) & "] " & _
     objExchange_MessageTrackingEntry.KeyID
   '
   ' Check whether there are any recipients listed.
   if (objExchange_MessageTrackingEntry.RecipientCount > 0) then
     ' If yes, then do the following:
     ' Display a heading.
     WScript.echo "        RecipientAddress : RecipientStatus"
     '
     ' Iterate through the recipient status arrays based on the
     ' number returned by RecipientCount.
     for intRecipientIndex = 0 to objExchange_MessageTrackingEntry.RecipientCount-1
       ' Display the value of the RecipientAddress and RecipientStatus properties.
       WScript.echo "        " & _
         objExchange_MessageTrackingEntry.RecipientAddress(intRecipientIndex) & _
         " : " & _
         objExchange_MessageTrackingEntry.RecipientStatus(intRecipientIndex)
       '
     ' Move to the next recipient.
     next
   else
     ' If no, indicate there no recipients listed.
     WScript.echo "    The RecipientAddress and RecipientStatus arrays were empty."
   end if
   '
   ' Move to the next Exchange_MessageTrackingEntry.
Next
end Sub

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.