| Visual Basic (Declaration) | |
|---|---|
Public Enum ImapCriterion Inherits System.Enum | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As ImapCriterion | |
| C# | |
|---|---|
public enum ImapCriterion : System.Enum | |
| Managed Extensions for C++ | |
|---|---|
__value public enum ImapCriterion : public System.Enum | |
| C++/CLI | |
|---|---|
public enum class ImapCriterion : public System.Enum | |
| Member | Description |
|---|---|
| All | Search for all messages (no restrictions). No search parameter is required. |
| Answered | Search for all answered messages (messages that have the Answered flag set). No search parameter is required. |
| Bcc | Search for messages that contain the specified string in the BCC field of the message envelope. |
| Before | Search for messages with internal date that occurs before the specified date. |
| Body | Search for messages that contain the specified string in the message body. |
| Cc | Search for messages that contain the specified string in the CC field of the message envelope. |
| Deleted | Search for deleted messages (messages that have the Deleted flag set). No search parameter is required. |
| Draft | Search for draft messages (messages that have the Draft flag set). No search parameter is required. |
| Flagged | Search for flagged messages (messages that have the Flagged flag set). No search parameter is required. |
| From | Search for messages that contain the specified string in the FROM field of the message envelope. |
| Header | Search for messages that contain the specified string in the message header. Note that the format requires that the header field be specified, so the parameter value for this search criterion should be "<header> <value>". |
| Keyword | Search for messages that have the specified keyword flag set. This allows for searches based on custom flag types. |
| Larger | Search for messages larger than the specified byte count. |
| New | Search for all recent and unseen messages (messages with the Recent flag set but not the Seen flag). No search parameter is required. |
| Not | Perform a logical inversion (NOT operation) on another search criterion. No search parameter is required if this is part of a collection of ImapSearchParameters and another search criterion follows this one; otherwise, a search parameter is required. |
| NotAnswered | Search for messages that do not have the Answered flag set. No search parameter is required. |
| NotDeleted | Search for messages that do not have the Deleted flag set. No search parameter is required. |
| NotDraft | Search for messages that do not have the Draft flag set. No search parameter is required. |
| NotFlagged | Search for messages that do not have the Flagged flag set. No search parameter is required. |
| NotKeyword | Search for messages that do not have the specified keyword flag set. This allows for searches based on custom flag types. |
| NotSeen | Search for messages that do not have the Seen flag set. No search parameter is required. |
| Old | Search for messages that do not have the Recent flag set. No search parameter is required. |
| On | Search for messages that have an internal date that exactly matches the value specified (disregarding time). |
| Or | Perform a logical OR operation on the two search criterion that follow this one. This search parameter must be followed by two other search parameters; these will represent the conditions to be ORed. |
| Recent | Search for recent messages (messages that have the Recent flag set). No search parameter is required. |
| Seen | Search for seen messages (messages that have the Seen flag set). No search parameter is required. |
| SentBefore | Search for messages sent before the specified date. |
| SentOn | Search for messages sent on the specified date. |
| SentSince | Search for messages sent after the specified date. |
| Since | Search for messages with internal date that occurs after the specified date. |
| Smaller | Search for messages smaller than the specified byte count. |
| Subject | Search for messages that contain the specified string in the message subject. |
| Text | Search for messages that contain the specified string in either the header or body of the message. |
| To | Search for messages that contain the specified string in the TO field of the message. |
| Uid | Search for messages that match the UID or range of UIDs specified. Ranges of UIDs can be specified using the format "<start>:<end>". |
The following example demonstrates using the Mailbox.Search method. This example constructs the search "SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM 'Smith'"
| Visual Basic | Copy Code |
|---|---|
' Login Imap1.Login(Server, User, Pass) ' Construct the search "SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM 'Smith'" Dim Criteria As New ArrayList() Criteria.Add(New ImapSearchParameter(ImapCriterion.Flagged, "")) Criteria.Add(New ImapSearchParameter(ImapCriterion.Since, "1-Feb-1994")) Criteria.Add(New ImapSearchParameter(ImapCriterion.Not, "")) Criteria.Add(New ImapSearchParameter(ImapCriterion.From, "Smith")) ' Alternatively, ImapSearchParameter objects can be created like so ' Dim Param As New ImapSearchParameter() ' Param.Criterion = ImapCriterion.Flagged ' Param.Paramter = "" ' Criteria.Add(Param) ' Perform the search. This will occur on the default box INBOX. Dim Messages() As ImapMessage = Imap1.CurrentMailbox.Search(Criteria) ' Display Debug.WriteLine("The following message IDs meet the specified criteria") Dim Message as ImapMessage For Each Message in Messages Debug.WriteLine(Message.Id) | |
| C# | Copy Code |
|---|---|
// Login imap1.Login(Server, User, Pass); // Construct the search "SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM 'Smith'" ArrayList criteria = new ArrayList(); criteria.Add(new ImapSearchParameter(ImapCriterion.Flagged, "")); criteria.Add(new ImapSearchParameter(ImapCriterion.Since, "1-Feb-1994")); criteria.Add(new ImapSearchParameter(ImapCriterion.Not, "")); criteria.Add(new ImapSearchParameter(ImapCriterion.From, "Smith")); /* / Alternatively, ImapSearchParameter objects can be created like so / ImapSearchParameter param = new ImapSearchParameter(); / param.Criterion = ImapCriterion.Flagged; / param.Paramter = ""; / criteria.Add(param); */ // Perform the search. This will occur on the default box INBOX. ImapMessage[] messages = imap1.CurrentMailbox.Search(criteria); // Display Debug.WriteLine("The following message IDs meet the specified criteria"); foreach(ImapMessage message in messages) Debug.WriteLine(message.Id); | |
The ImapCriterion enumeration specifies types of search restrictions when using the Mailbox.Search method. Use this enumeration with the ImapSearchParameter class, to create custom searches of messages on the IMAP server.
System.Object
System.ValueType
System.Enum
Dart.PowerTCP.Mail.ImapCriterion
Target Platforms: Microsoft .NET Framework 2.0