MAPIQueryRecipientListCount

Syntax

MAPIQueryRecipientListCount(Recipients)

Remarks

Returns the number of names in a recipient list.

Argument

Explanation

Recipients

A handle to a recipient list


The following table lists the possible return values of the MAPIQueryRecipientListCount function and their meanings.

Value

Meaning

0

Recipients is not a valid handle to a recipient list, or the recipient list is empty.

Positive integer

The number of recipients in the recipient list.


Example

The following example displays the Mail Address Book, and then the number of resolved recipients selected by the user.


Sub MAIN
MAPI_LOGON_UI = 1
Session = MAPILogon(0, "", "", MAPI_LOGON_UI, 0)
RecipList = MAPIAddress(Session, 0, "", 4, "", 0, 0)
TotalCount = MAPIQueryRecipientListCount(RecipList)
ResolvedCount = 0
For i = 0 To TotalCount - 1
    RecipName$ = ""
    Address$ = ""
    result = MAPIQueryRecipientListElement(RecipList, i, RecipName$,\
      Address$)
    If Address$ <> "" Then ResolvedCount = ResolvedCount + 1
Next
MsgBox Str$(ResolvedCount) + " of " + Str$(TotalCount) + " recipients resolved"
result = MAPILogoff(Session, 0, 0, 0)
End Sub