MAPIQueryRecipientListElement

Syntax

MAPIQueryRecipientListElement(Recipients, RecipIndex, RecipName$, Address$)

Remarks

Retrieves information about one recipient in a recipient list. MAPIQueryRecipientList and MAPIQueryRecipientListElement return the same information about recipients. MAPIQueryRecipientList steps through the recipient list one-at-a-time in order, while MAPIQueryRecipientListElement retrieves information about one recipient anywhere in the list.

Recipients must be a handle to a recipient list of the type returned by MAPIAddress. Use RecipIndex to specify which recipient to query.

Argument

Explanation

Recipients

A handle to a recipient list.

RecipIndex

The index of the recipient to query. Recipients are numbered from
0 (zero) to MAPIQueryRecipientListCount minus 1.

RecipName$

The friendly name of the recipient as displayed by the messaging system.

Address$

Provider-specific message delivery data. This field can be used by the message system to identify recipients who are not in an address list (custom recipients).


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

Value

Name

Meaning

0

MAPI_ORIG

The recipient is the originator of the message.

1

MAPI_TO

The recipient is a To recipient of the message.

2

MAPI_CC

The recipient is a carbon-copy (CC) recipient of the message.

3

MAPI_BCC

The recipient is a blind carbon-copy (BCC) recipient of the message.


Example

The following example displays the Mail Address Book, and then the name and address of the last name selected by the user.


Sub MAIN
MAPI_LOGON_UI = 1
Session = MAPILogon(0, "", "", MAPI_LOGON_UI, 0)
RecipList = MAPIAddress(Session, 0, "", 4, "", 0, 0)
RecipCount = MAPIQueryRecipientListCount(RecipList)
Dim RecipName$, Address$
result = MAPIQueryRecipientListElement(RecipList, RecipCount - 1, \
        RecipName$, Address$)
MsgBox RecipName$ + " @ " + Address$
result = MAPILogoff(Session, 0, 0, 0)
End Sub