Reading Mail
Reading mail is a two-step process. First, the MAPIMessages control’s Fetch method retrieves messages from the Inbox into the control’s read buffer. Then messages are read by setting and reading the control’s properties. These properties will be discussed shortly, after the Fetch method is described.
The Fetch method has no parameters. Rather, its behavior is modified by the settings of some of the properties of the MAPIMessages control.
The
FetchUnreadOnly property is a
Boolean flag that, if set to True, causes a
subsequent call to Fetch to retrieve only those messages that
haven’t been read (i.e., the MsgRead property is
False). If the FetchUnreadOnly property is
False, its default value, the next call to Fetch
retrieves all messages from the Inbox.
The FetchSorted property is a Boolean
flag that, if set to True, causes a subsequent
call to Fetch to sort the retrieved messages according to the order
in which they were received. If the FetchSorted property is
False, its default value, the messages are sorted
according to the order specified by the Inbox. The MAPI controls
don’t provide a way to modify the Inbox sort order.
The FetchMessageType property is a string that allows you to fetch messages that belong to a certain message class. When this property contains a zero-length string (as it does by default), messages are retrieved without regard to their message class. However, when this property has some other value, a subsequent Fetch retrieves only those messages ...