C# Class MailKit.Search.SearchQuery

A specialized query for searching messages in a IMailFolder.
A specialized query for searching messages in a IMailFolder.
ファイルを表示 Open project: jstedfast/MailKit Class Usage Examples

Public Properties

Property Type Description
All SearchQuery
Answered SearchQuery
Deleted SearchQuery
Draft SearchQuery
Flagged SearchQuery
New SearchQuery
NotAnswered SearchQuery
NotDeleted SearchQuery
NotDraft SearchQuery
NotFlagged SearchQuery
NotRecent SearchQuery
NotSeen SearchQuery
Recent SearchQuery
Seen SearchQuery

Public Methods

Method Description
And ( SearchQuery expr ) : BinarySearchQuery

Create a conditional AND operation.

A conditional AND operation only evaluates the second operand if the first operand evaluates to true.

And ( SearchQuery left, SearchQuery right ) : BinarySearchQuery

Create a conditional AND operation.

A conditional AND operation only evaluates the second operand if the first operand evaluates to true.

BccContains ( string text ) : TextSearchQuery

Match messages where the Bcc header contains the specified text.

Matches messages where the Bcc header contains the specified text.

BodyContains ( string text ) : TextSearchQuery

Match messages where the message body contains the specified text.

Matches messages where the message body contains the specified text.

CcContains ( string text ) : TextSearchQuery

Match messages where the Cc header contains the specified text.

Matches messages where the Cc header contains the specified text.

ChangedSince ( ulong modseq ) : SearchQuery

Match messages that have mod-sequence values greater than or equal to the specified mod-sequence value.

Matches messages that have mod-sequence values greater than or equal to the specified mod-sequence value.

DeliveredAfter ( System.DateTime date ) : DateSearchQuery

Match messages that were delivered after the specified date.

Matches messages that were delivered after the specified date.

DeliveredBefore ( System.DateTime date ) : DateSearchQuery

Match messages that were delivered before the specified date.

Matches messages that were delivered before the specified date.

DeliveredOn ( System.DateTime date ) : DateSearchQuery

Match messages that were delivered on the specified date.

Matches messages that were delivered on the specified date.

DoesNotHaveCustomFlag ( string flag ) : TextSearchQuery

Match messages that do not have the specified custom flag set.

Matches messages that do not have the specified custom flag set.

DoesNotHaveCustomFlags ( IEnumerable flags ) : SearchQuery

Match messages that do not have the specified custom flags set.

Matches messages that do not have the specified custom flags set.

DoesNotHaveFlags ( MessageFlags flags ) : SearchQuery

Match messages that do not have the specified flags set.

Matches messages that do not have the specified flags set.

Filter ( string name ) : SearchQuery

Match messages using a saved search filter.

Matches messages using a saved search filter.

FromContains ( string text ) : TextSearchQuery

Match messages where the From header contains the specified text.

Matches messages where the From header contains the specified text.

Fuzzy ( SearchQuery expr ) : UnarySearchQuery

Apply a fuzzy matching algorithm to the specified expression.

Applies a fuzzy matching algorithm to the specified expression.

This feature is not supported by all IMAP servers.
GMailMessageId ( ulong id ) : NumericSearchQuery

Match messages that have the specified GMail message identifier.

This search term can only be used with GMail.

GMailRawSearch ( string expression ) : TextSearchQuery

Match messages using the GMail search expression.

This search term can only be used with GMail.

GMailThreadId ( ulong thread ) : NumericSearchQuery

Match messages belonging to the specified GMail thread.

This search term can only be used with GMail.

HasCustomFlag ( string flag ) : TextSearchQuery

Match messages that have the specified custom flag set.

Matches messages that have the specified custom flag set.

HasCustomFlags ( IEnumerable flags ) : SearchQuery

Match messages that have the specified custom flags set.

Matches messages that have the specified custom flags set.

HasFlags ( MessageFlags flags ) : SearchQuery

Match messages that have the specified flags set.

Matches messages that have the specified flags set.

HasGMailLabel ( string label ) : TextSearchQuery

Match messages that have the specified GMail label.

This search term can only be used with GMail.

HeaderContains ( string field, string text ) : HeaderSearchQuery

Match messages where the specified header contains the specified text.

Matches messages where the specified header contains the specified text.

LargerThan ( int octets ) : NumericSearchQuery

Match messages that are larger than the specified number of octets.

Matches messages that are larger than the specified number of octets.

MessageContains ( string text ) : TextSearchQuery

Match messages where the raw message contains the specified text.

Matches messages where the raw message contains the specified text.

Not ( SearchQuery expr ) : UnarySearchQuery

Create a logical negation of the specified expression.

Creates a logical negation of the specified expression.

OlderThan ( int seconds ) : NumericSearchQuery

Match messages older than the specified number of seconds.

Matches messages older than the specified number of seconds.

Or ( SearchQuery expr ) : BinarySearchQuery

Create a conditional OR operation.

A conditional OR operation only evaluates the second operand if the first operand evaluates to true.

Or ( SearchQuery left, SearchQuery right ) : BinarySearchQuery

Create a conditional OR operation.

A conditional OR operation only evaluates the second operand if the first operand evaluates to false.

SearchQuery ( ) : System

Initializes a new instance of the T:MailKit.Search.SearchQuery class.

Creates a new SearchQuery that matches all messages.

SentAfter ( System.DateTime date ) : DateSearchQuery

Match messages that were sent after the specified date.

Matches messages that were sent after the specified date.

SentBefore ( System.DateTime date ) : DateSearchQuery

Match messages that were sent before the specified date.

Matches messages that were sent before the specified date.

SentOn ( System.DateTime date ) : DateSearchQuery

Match messages that were sent on the specified date.

Matches messages that were sent on the specified date.

SmallerThan ( int octets ) : NumericSearchQuery

Match messages that are smaller than the specified number of octets.

Matches messages that are smaller than the specified number of octets.

SubjectContains ( string text ) : TextSearchQuery

Match messages where the Subject header contains the specified text.

Matches messages where the Subject header contains the specified text.

ToContains ( string text ) : TextSearchQuery

Match messages where the To header contains the specified text.

Matches messages where the To header contains the specified text.

Uids ( IList uids ) : UidSearchQuery

Limit the search query to messages with the specified unique identifiers.

Limits the search query to messages with the specified unique identifiers.

YoungerThan ( int seconds ) : NumericSearchQuery

Match messages younger than the specified number of seconds.

Matches messages younger than the specified number of seconds.

Protected Methods

Method Description
SearchQuery ( SearchTerm term ) : System

Initializes a new instance of the T:MailKit.Search.SearchQuery class.

Creates a new SearchQuery with the specified search term.

Private Methods

Method Description
Header ( string field, string text ) : HeaderSearchQuery
Optimize ( ISearchQueryOptimizer optimizer ) : SearchQuery

Method Details

And() public method

Create a conditional AND operation.
A conditional AND operation only evaluates the second operand if the first operand evaluates to true.
/// is null. ///
public And ( SearchQuery expr ) : BinarySearchQuery
expr SearchQuery An additional query to execute.
return BinarySearchQuery

And() public static method

Create a conditional AND operation.
A conditional AND operation only evaluates the second operand if the first operand evaluates to true.
/// is null. /// -or- /// is null. ///
public static And ( SearchQuery left, SearchQuery right ) : BinarySearchQuery
left SearchQuery The first operand.
right SearchQuery The second operand.
return BinarySearchQuery

BccContains() public static method

Match messages where the Bcc header contains the specified text.
Matches messages where the Bcc header contains the specified text.
/// is null. /// /// is empty. ///
public static BccContains ( string text ) : TextSearchQuery
text string The text to match against.
return TextSearchQuery

BodyContains() public static method

Match messages where the message body contains the specified text.
Matches messages where the message body contains the specified text.
/// is null. /// /// is empty. ///
public static BodyContains ( string text ) : TextSearchQuery
text string The text to match against.
return TextSearchQuery

CcContains() public static method

Match messages where the Cc header contains the specified text.
Matches messages where the Cc header contains the specified text.
/// is null. /// /// is empty. ///
public static CcContains ( string text ) : TextSearchQuery
text string The text to match against.
return TextSearchQuery

ChangedSince() public static method

Match messages that have mod-sequence values greater than or equal to the specified mod-sequence value.
Matches messages that have mod-sequence values greater than or equal to the specified mod-sequence value.
public static ChangedSince ( ulong modseq ) : SearchQuery
modseq ulong The mod-sequence value.
return SearchQuery

DeliveredAfter() public static method

Match messages that were delivered after the specified date.
Matches messages that were delivered after the specified date.
public static DeliveredAfter ( System.DateTime date ) : DateSearchQuery
date System.DateTime The date.
return DateSearchQuery

DeliveredBefore() public static method

Match messages that were delivered before the specified date.
Matches messages that were delivered before the specified date.
public static DeliveredBefore ( System.DateTime date ) : DateSearchQuery
date System.DateTime The date.
return DateSearchQuery

DeliveredOn() public static method

Match messages that were delivered on the specified date.
Matches messages that were delivered on the specified date.
public static DeliveredOn ( System.DateTime date ) : DateSearchQuery
date System.DateTime The date.
return DateSearchQuery

DoesNotHaveCustomFlag() public static method

Match messages that do not have the specified custom flag set.
Matches messages that do not have the specified custom flag set.
/// is null. /// /// is empty. ///
public static DoesNotHaveCustomFlag ( string flag ) : TextSearchQuery
flag string The custom flag.
return TextSearchQuery

DoesNotHaveCustomFlags() public static method

Match messages that do not have the specified custom flags set.
Matches messages that do not have the specified custom flags set.
/// is null. /// /// One or more of the is null or empty. /// -or- /// No custom flags were given. ///
public static DoesNotHaveCustomFlags ( IEnumerable flags ) : SearchQuery
flags IEnumerable The custom flags.
return SearchQuery

DoesNotHaveFlags() public static method

Match messages that do not have the specified flags set.
Matches messages that do not have the specified flags set.
/// does not contain any of the valie flag values. ///
public static DoesNotHaveFlags ( MessageFlags flags ) : SearchQuery
flags MessageFlags The message flags.
return SearchQuery

Filter() public static method

Match messages using a saved search filter.
Matches messages using a saved search filter.
public static Filter ( string name ) : SearchQuery
name string The name of the saved search.
return SearchQuery

FromContains() public static method

Match messages where the From header contains the specified text.
Matches messages where the From header contains the specified text.
/// is null. /// /// is empty. ///
public static FromContains ( string text ) : TextSearchQuery
text string The text to match against.
return TextSearchQuery

Fuzzy() public static method

Apply a fuzzy matching algorithm to the specified expression.

Applies a fuzzy matching algorithm to the specified expression.

This feature is not supported by all IMAP servers.
/// is null. ///
public static Fuzzy ( SearchQuery expr ) : UnarySearchQuery
expr SearchQuery The expression
return UnarySearchQuery

GMailMessageId() public static method

Match messages that have the specified GMail message identifier.
This search term can only be used with GMail.
public static GMailMessageId ( ulong id ) : NumericSearchQuery
id ulong The GMail message identifier.
return NumericSearchQuery

GMailRawSearch() public static method

Match messages using the GMail search expression.
This search term can only be used with GMail.
/// is null. /// /// is empty. ///
public static GMailRawSearch ( string expression ) : TextSearchQuery
expression string The raw GMail search text.
return TextSearchQuery

GMailThreadId() public static method

Match messages belonging to the specified GMail thread.
This search term can only be used with GMail.
public static GMailThreadId ( ulong thread ) : NumericSearchQuery
thread ulong The GMail thread.
return NumericSearchQuery

HasCustomFlag() public static method

Match messages that have the specified custom flag set.
Matches messages that have the specified custom flag set.
/// is null. /// /// is empty. ///
public static HasCustomFlag ( string flag ) : TextSearchQuery
flag string The custom flag.
return TextSearchQuery

HasCustomFlags() public static method

Match messages that have the specified custom flags set.
Matches messages that have the specified custom flags set.
/// is null. /// /// One or more of the is null or empty. /// -or- /// No custom flags were given. ///
public static HasCustomFlags ( IEnumerable flags ) : SearchQuery
flags IEnumerable The custom flags.
return SearchQuery

HasFlags() public static method

Match messages that have the specified flags set.
Matches messages that have the specified flags set.
/// does not contain any of the valie flag values. ///
public static HasFlags ( MessageFlags flags ) : SearchQuery
flags MessageFlags The message flags.
return SearchQuery

HasGMailLabel() public static method

Match messages that have the specified GMail label.
This search term can only be used with GMail.
/// is null. /// /// is empty. ///
public static HasGMailLabel ( string label ) : TextSearchQuery
label string The GMail label.
return TextSearchQuery

HeaderContains() public static method

Match messages where the specified header contains the specified text.
Matches messages where the specified header contains the specified text.
/// is null. /// -or- /// is null. /// /// is empty. /// -or- /// is empty. ///
public static HeaderContains ( string field, string text ) : HeaderSearchQuery
field string The header field to match against.
text string The text to match against.
return HeaderSearchQuery

LargerThan() public static method

Match messages that are larger than the specified number of octets.
Matches messages that are larger than the specified number of octets.
/// is a negative value. ///
public static LargerThan ( int octets ) : NumericSearchQuery
octets int The number of octets.
return NumericSearchQuery

MessageContains() public static method

Match messages where the raw message contains the specified text.
Matches messages where the raw message contains the specified text.
/// is null. /// /// is empty. ///
public static MessageContains ( string text ) : TextSearchQuery
text string The text to match against.
return TextSearchQuery

Not() public static method

Create a logical negation of the specified expression.
Creates a logical negation of the specified expression.
/// is null. ///
public static Not ( SearchQuery expr ) : UnarySearchQuery
expr SearchQuery The expression
return UnarySearchQuery

OlderThan() public static method

Match messages older than the specified number of seconds.
Matches messages older than the specified number of seconds.
/// The number of seconds cannot be less than 1. ///
public static OlderThan ( int seconds ) : NumericSearchQuery
seconds int The number of seconds.
return NumericSearchQuery

Or() public method

Create a conditional OR operation.
A conditional OR operation only evaluates the second operand if the first operand evaluates to true.
/// is null. ///
public Or ( SearchQuery expr ) : BinarySearchQuery
expr SearchQuery An additional query to execute.
return BinarySearchQuery

Or() public static method

Create a conditional OR operation.
A conditional OR operation only evaluates the second operand if the first operand evaluates to false.
/// is null. /// -or- /// is null. ///
public static Or ( SearchQuery left, SearchQuery right ) : BinarySearchQuery
left SearchQuery The first operand.
right SearchQuery The second operand.
return BinarySearchQuery

SearchQuery() public method

Initializes a new instance of the T:MailKit.Search.SearchQuery class.
Creates a new SearchQuery that matches all messages.
public SearchQuery ( ) : System
return System

SearchQuery() protected method

Initializes a new instance of the T:MailKit.Search.SearchQuery class.
Creates a new SearchQuery with the specified search term.
protected SearchQuery ( SearchTerm term ) : System
term SearchTerm The search term.
return System

SentAfter() public static method

Match messages that were sent after the specified date.
Matches messages that were sent after the specified date.
public static SentAfter ( System.DateTime date ) : DateSearchQuery
date System.DateTime The date.
return DateSearchQuery

SentBefore() public static method

Match messages that were sent before the specified date.
Matches messages that were sent before the specified date.
public static SentBefore ( System.DateTime date ) : DateSearchQuery
date System.DateTime The date.
return DateSearchQuery

SentOn() public static method

Match messages that were sent on the specified date.
Matches messages that were sent on the specified date.
public static SentOn ( System.DateTime date ) : DateSearchQuery
date System.DateTime The date.
return DateSearchQuery

SmallerThan() public static method

Match messages that are smaller than the specified number of octets.
Matches messages that are smaller than the specified number of octets.
/// is a negative value. ///
public static SmallerThan ( int octets ) : NumericSearchQuery
octets int The number of octets.
return NumericSearchQuery

SubjectContains() public static method

Match messages where the Subject header contains the specified text.
Matches messages where the Subject header contains the specified text.
/// is null. /// /// is empty. ///
public static SubjectContains ( string text ) : TextSearchQuery
text string The text to match against.
return TextSearchQuery

ToContains() public static method

Match messages where the To header contains the specified text.
Matches messages where the To header contains the specified text.
/// is null. /// /// is empty. ///
public static ToContains ( string text ) : TextSearchQuery
text string The text to match against.
return TextSearchQuery

Uids() public static method

Limit the search query to messages with the specified unique identifiers.
Limits the search query to messages with the specified unique identifiers.
/// is null. /// /// is empty. ///
public static Uids ( IList uids ) : UidSearchQuery
uids IList The unique identifiers.
return UidSearchQuery

YoungerThan() public static method

Match messages younger than the specified number of seconds.
Matches messages younger than the specified number of seconds.
/// The number of seconds cannot be less than 1. ///
public static YoungerThan ( int seconds ) : NumericSearchQuery
seconds int The number of seconds.
return NumericSearchQuery

Property Details

All public_oe static_oe property

Match all messages in the folder.
Matches all messages in the folder.
public static SearchQuery,MailKit.Search All
return SearchQuery

Answered public_oe static_oe property

Match messages with the MessageFlags.Answered flag set.
Matches messages with the MessageFlags.Answered flag set.
public static SearchQuery,MailKit.Search Answered
return SearchQuery

Deleted public_oe static_oe property

Match messages with the MessageFlags.Deleted flag set.
Matches messages with the MessageFlags.Deleted flag set.
public static SearchQuery,MailKit.Search Deleted
return SearchQuery

Draft public_oe static_oe property

Match messages with the MessageFlags.Draft flag set.
Matches messages with the MessageFlags.Draft flag set.
public static SearchQuery,MailKit.Search Draft
return SearchQuery

Flagged public_oe static_oe property

Match messages with the MessageFlags.Flagged flag set.
Matches messages with the MessageFlags.Flagged flag set.
public static SearchQuery,MailKit.Search Flagged
return SearchQuery

New public_oe static_oe property

Match messages with the MessageFlags.Recent flag set but not the MessageFlags.Seen.
Matches messages with the MessageFlags.Recent flag set but not the MessageFlags.Seen.
public static SearchQuery,MailKit.Search New
return SearchQuery

NotAnswered public_oe static_oe property

Match messages that do not have the MessageFlags.Answered flag set.
Matches messages that do not have the MessageFlags.Answered flag set.
public static SearchQuery,MailKit.Search NotAnswered
return SearchQuery

NotDeleted public_oe static_oe property

Match messages that do not have the MessageFlags.Deleted flag set.
Matches messages that do not have the MessageFlags.Deleted flag set.
public static SearchQuery,MailKit.Search NotDeleted
return SearchQuery

NotDraft public_oe static_oe property

Match messages that do not have the MessageFlags.Draft flag set.
Matches messages that do not have the MessageFlags.Draft flag set.
public static SearchQuery,MailKit.Search NotDraft
return SearchQuery

NotFlagged public_oe static_oe property

Match messages that do not have the MessageFlags.Flagged flag set.
Matches messages that do not have the MessageFlags.Flagged flag set.
public static SearchQuery,MailKit.Search NotFlagged
return SearchQuery

NotRecent public_oe static_oe property

Match messages that do not have the MessageFlags.Recent flag set.
Matches messages that do not have the MessageFlags.Recent flag set.
public static SearchQuery,MailKit.Search NotRecent
return SearchQuery

NotSeen public_oe static_oe property

Match messages that do not have the MessageFlags.Seen flag set.
Matches messages that do not have the MessageFlags.Seen flag set.
public static SearchQuery,MailKit.Search NotSeen
return SearchQuery

Recent public_oe static_oe property

Match messages with the MessageFlags.Recent flag set.
Matches messages with the MessageFlags.Recent flag set.
public static SearchQuery,MailKit.Search Recent
return SearchQuery

Seen public_oe static_oe property

Match messages with the MessageFlags.Seen flag set.
Matches messages with the MessageFlags.Seen flag set.
public static SearchQuery,MailKit.Search Seen
return SearchQuery