FindMessage Method  
 

Search for a message in the current message store.

Syntax

object.FindMessage( HeaderField, HeaderValue, [MessageIndex], [Options] )

Parameters

HeaderField
A string which specifies the name of the header field that should be searched. The header field name is not case sensitive.
HeaderValue
A string which specifies the header value that should be searched for. The search options can be used to specify if the search is case-sensitive, and whether the search should return partial matches to the string.
MessageIndex
An optional integer value which specifies the message number that should be used when starting the search. If this parameter is omitted, the search will begin with the first message in the message store.
Options
An optional integer value which specifies how the search will be performed. If this parameter is omitted, the default search options will be used. One or more of the following values may be specified:
Value Description
mimeSearchDefault Perform a complete match against the specified header value. The comparison is not case-sensitive. It is the default search option used if this parameter is omitted.
mimeSearchCaseSensitive The header value comparison will be case-sensitive. Note that this does not affect header field names. Matches for header names are always case-insensitive.
mimeSearchPartialMatch Perform a partial match against the specified header value. It recommended that this option be used when searching for matches to email addresses.
mimeSearchDecodeHeaders Decode any encoded message headers before comparing them to the specified value. This option can increase the amount of time required to search the message store and should only be used when necessary.

Return Value

If the method is successful, it returns the message number which specifies the message that matches the search criteria. If no matching message could be found, the method will return zero.

Remarks

The FindMessage method is used to search the message store for a message which matches a specific header field value. For example, it can be used to find every message which is addressed to a specific recipient or has a subject which matches a particular string value.

See Also

StoreCount Property, StoreIndex Property, CloseStore Method, OpenStore Method, ReadStore Method, WriteStore Method