Keyword queries and search conditions for Compliance Search in Office 365 Dedicated

 

Applies to: Exchange Online Dedicated

This topic describes the email and document properties that you can search for in email items in Exchange Online by using the Compliance Search feature in the Exchange admin center (EAC) in Office 365 Dedicated. The topic describes the mail properties that you can search, the supported Boolean search operators, and the search conditions that you can use to narrow your search results. Compliance Search uses the Keyword Query Language (KQL). For detailed information about KQL, see Keyword Query Language syntax reference.

For more information, see Compliance Search in Office 365 Dedicated.

Contents

Searchable email properties

Search operators

Search conditions

Search tips and tricks

Searchable email properties

The following table lists email message properties that can be searched by using the Search feature in the or by using the New-ComplianceSearch or the Set-ComplianceSearch cmdlet. The table includes an example of the property:value syntax for each property and a description of the search results returned by the examples. You can type these property:value pairs in the keywords box for a compliance search.

Property Property description Examples Search results returned by the examples

Attachment

The names of files attached to an email message.

attachment:annualreport.ppt

attachment:annual*

Messages that have an attached file named annualreport.ppt. In the second example, using the wildcard returns messages with the word "annual" in the file name of an attachment.

Bcc

The BCC field of an email message.1

bcc:pilarp@contoso.com

bcc:pilarp

bcc:"Pilar Pinilla"

All examples return messages with Pilar Pinilla included in the Bcc field.

Body

Text in the body of an email message.

body:"Northwind Traders"

body:north*

Messages with the exact phrase "Northwind Traders" in the body of the message. The second example returns any message that contains words that begin with the string "north", such as north, northwind, or northern.

Category

The categories to search. Categories can be defined by users by using Outlook or Outlook Web App. The possible values are:

  • blue

  • green

  • orange

  • purple

  • red

  • yellow

category:"Red Category"

Messages that have been assigned the red category in the source mailboxes.

Cc

The CC field of an email message.1

cc:pilarp@contoso.com

cc:"Pilar Pinilla"

In both examples, messages with Pilar Pinilla specified in the CC field.

From

The sender of an email message.1

from:pilarp@contoso.com

from:contoso.com

Messages sent by the specified user or sent from a specified domain.

Importance

The importance of an email message, which a sender can specify when sending a message. By default, messages are sent with normal importance, unless the sender sets the importance as high or low.

importance:high

importance:medium

importance:low

Messages that are marked as high importance, medium importance, or low importance.

Kind

The message type to search. Possible values:

  • contacts

  • docs

  • email

  • faxes

  • im

  • journals

  • meetings

  • notes

  • posts

  • rssfeeds

  • tasks

  • voicemail

kind:email

kind:email OR kind:im OR kind:voicemail

Email messages that meet the search criteria. The second example returns email messages, instant messaging conversations, and voice messages that meet the search criteria.

Participants

All the people fields in an email message; these fields are From, To, CC, and BCC.1

participants:garthf@contoso.com

participants:contoso.com

Messages sent by or sent to garthf@contoso.com. The second example returns all messages sent by or sent to a user in the contoso.com domain.

Received

The date that an email message was received by a recipient.

received:04/15/2014

received>=01/01/2014 AND received<=03/31/2014

Messages that were received on April 15, 2014. The second example returns all messages received between January 1, 2014 and March 31, 2014.

Recipients

All recipient fields in an email message; these fields are To, CC, and BCC.1

recipients:garthf@contoso.com

recipients:contoso.com

Messages sent to garthf@contoso.com. The second example returns messages sent to any recipient in the contoso.com domain.

Sent

The date that an email message was sent by the sender.

sent:07/01/2014

sent>=06/01/2014 AND sent<=07/01/2014

Messages that were sent on the specified date or sent within the specified date range.

Size

The size of an item, in bytes.

size>2621440

size:1..50000

Messages larger than 25 MB. The second example returns messages from 1 through 50,000 bytes in size.

Subject

The text in the subject line of an email message.

subject:"Quarterly Financials"

subject:northwind

Messages that contain the exact phrase "Quarterly Financials" in the subject line. The second example returns all messages that contain the word northwind in the subject line.

To

The To field of an email message.1

to:annb@contoso.com

to:annb

to:"Ann Beebe"

All examples return messages where Ann Beebe is specified in the To: line.

Note

1   For the value of a recipient property, you can use the SMTP address, display name, or alias to specify a user. For example, you can use annb@contoso.com, annb, or "Ann Beebe" to specify the user Ann Beebe.

Return to top

Search operators

Boolean search operators, such as AND, OR, and NOT, help you define more-precise mailbox searches by including or excluding specific words in the search query. Other techniques, such as using property operators (such as >= or ..), quotation marks, parentheses, and wildcards, help you refine a search query. The following table lists the operators that you can use to narrow or broaden search results.

Operator Usage Description

AND

keyword1 AND keyword2

Returns items that include all of the specified keywords or property:value expressions. For example, from:"Ann Beebe" AND subject:northwind would return all messages sent by Ann Beebe that contained the word northwind in the subject line.2

+

keyword1 + keyword2

The same as the AND operator.

OR

keyword1 OR keyword2

Returns items that include one or more of the specified keywords or property:value expressions.2

NOT

keyword1 NOT keyword2

NOT from:"Ann Beebe"

Excludes items specified by a keyword or a property:value expression. For example, NOT from:"Ann Beebe" excludes messages sent by Ann Beebe.2

-

keyword1 -keyword2

The same as the NOT operator.

NEAR

keyword1 NEAR(n) keyword2

Returns items with words that are near each other, where n equals the number of words apart. For example, best NEAR(5) worst returns any item where the word "worst" is within five words of "best". If no number is specified, the default distance is eight words.2

ONEAR

keyword1 ONEAR(n) keyword2

Similar to NEAR, but returns items with words that are near each other in the specified order. For example, best ONEAR(5) worst returns any item where the word "best" occurs before the word "worst" and the two words are within five words of each other. If no number is specified, the default distance is eight words.2

=

property=value

Returns items that are an exact match of the specified value.

:

property:value

The colon (:) in the property:value syntax specifies that the value of the property being searched for contains the specified value. For example, recipients:garthf@contoso.com returns any message sent to garthf@contoso.com.

<

property<value

Denotes that the property being searched is less than the specified value. 1

>

property>value

Denotes that the property being searched is greater than the specified value.1

<=

property<=value

Denotes that the property being searched is less than or equal to a specific value.1

>=

property>=value

Denotes that the property being searched is greater than or equal to a specific value.1

..

property:value1..value2

Denotes that the property being searched is greater than or equal to value1 and less than or equal to value2.1

" "

"fair value"

subject:"Quarterly Financials"

Use double quotation marks (" ") to search for an exact phrase or term in keyword and property:value search queries.

*

cat*

subject:set*

Prefix wildcard searches (where the asterisk is placed at the end of a word) match for zero or more characters in keywords or property:value queries. For example, title:set* returns documents that contain the word set, setup, and setting (and other words that start with "set") in the document title.

( )

(fair OR free) AND (from:contoso.com)

(IPO OR initial) AND (stock OR shares)

(quarterly financials)

Parentheses group together Boolean phrases, property:value items, and keywords. For example, (quarterly financials) returns items that contain the words quarterly and financials.

Note

1   Use this operator for properties that have date or numeric values.
2   Boolean search operators must be uppercase; for example, AND. Using lowercase operators in search queries will return an error.

Return to top

Search conditions

You can use conditions to your search queries to narrow a search and return a more refined set of results. Each condition adds a clause to the KQL search query that is created and run when you start the search.

Important

Conditions for document properties are shown on the New search page in the EAC even though searching for documents on SharePoint sites isn't supported by Office 365 Dedicated.

Conditions for mail properties

Create a condition using mail properties when searching mailboxes. The following table lists the email properties that you can use for a condition. Note that these properties are a subset of the email properties that were previously described; these descriptions are repeated for your convenience.

Property Property description

Participants

All the people fields in an email message; these fields are From, To, CC, and BCC.

Sender

The sender of an email message.

Recipient

The person an email message was sent to. This is the same property as the To email property.

Subject

The text in the subject line of an email message.

Received date

The date that an email message was received by a recipient. This is the same property as the Received email property.

Sent date

The date that an email message was sent by the sender. This is the same property as the Sent email property.

Message type

The message type to search. This is the same property as the Kind email property.

The message type to search. Possible values:

  • contacts

  • docs

  • email

  • faxes

  • im

  • journals

  • meetings

  • notes

  • posts

  • rssfeeds

  • tasks

  • voicemail

Return to top

Conditions for common properties

Common properties are designed to be used when searching mailboxes and sites in the same search in other versions of Office 365. But you can still use them in Office 365 Dedicated when searching mailboxes. Alternatively, you can use just use the conditions for mailbox properties mail described in the previous section. The following table lists the available properties to use when adding a condition.

Property Property description

Date

For email, the date a message was received by a recipient or sent by the sender.

Size

For email, the size of the item (in bytes).

Sender/Author

For email, the person who sent a message.

Subject/Title

For email, the text in the subject line of a message.

Return to top

Operators used with conditions

When you add a condition, you can select an operator that is relevant to type of property for the condition. The following table describes the operators that are used with conditions and lists the equivalent that is used in the search query.

Operator Query equivalent Description

After

property>date

Used with date conditions. Returns items that were sent, received, or modified after the specified date.

Before

property<date

Used with date conditions. Returns items that were sent, received, or modified before the specified date.

Between

date..date

Use with date and size conditions. When used with a date condition, returns items there were sent, received, or modified within the specified date range. When used with a size condition, returns items whose size is within the specified range.

Contains any of

(property:value) OR (property:value)

Used with conditions for properties that specify a string value. Returns items that contain any part of one or more specified string values.

Doesn't contain any of

-property:value

NOT property:value

Used with conditions for properties that specify a string value. Returns items that don't contain any part of the specified string value.

Doesn't equal any of

-property=value

NOT property=value

Used with conditions for properties that specify a string value. Returns items that don't contain the specific string.

Equals

Size=value

Returns items that are equal to the specified size.1

Equals any of

(property=value) OR (property=value)

Used with conditions for properties that specify a string value. Returns items that are an exact match of one or more specified string values.

Greater

Size>value

Returns items where the specified property is greater than the specified value.1

Greater or equal

Size>=value

Returns items where the specified property is greater than or equal to the specified value.1

Less

Size<value

Returns items that are greater than or equal to the specific value.1

Less or equal

Size<=value

Returns items that are greater than or equal to the specific value.1

Not equal

Size<>value

Returns items that don't equal the specified size.1

Note

1   This operator is available only for conditions that use the Size property.

Return to top

Guidelines for using conditions

Keep the following in mind when using search conditions.

  • A condition is logically connected to the keyword query (specified in the keyword box) by the AND operator. That means that items have to satisfy both the keyword query and the condition to be included in the results. This is how conditions help to narrow your results.

  • If you add two or more unique conditions to a search query (conditions that specify different properties), those conditions are logically connected by the AND operator. That means only items that satisfy all the conditions (in addition to any keyword query) are returned.

  • If you add more than one condition for the same property, those conditions are logically connected by the OR operator. That means items that satisfy the keyword query and any one of the conditions are returned. So, groups of the same conditions are connected to each other by the OR operator and then sets of unique conditions are connected by the AND operator.

  • If you add multiple values (separated by commas or semi-colons) to a single condition, those values are connected by the OR operator. That means items are returned if they contain any of the specified values for the property in the condition.

  • The search query that is created by using the keywords box and conditions is displayed on the Search page, in the details pane for the selected search. In a query, everything to the right of the notation (c:c) indicates conditions that are added to the query.

  • Conditions only add properties to the search query; the don't add operators. This is why the query displayed in the details pane doesn't show operators to the right of the (c:c) notation. KQL adds the logical operators (according to the previously explained rules) when the executing the query.

  • You can use the drag and drop control to re-sequence the order of conditions. Just click on the control for a condition and move it up or down.

  • As previously explained, some condition properties allow you to type multiple values. Each value is logically connected by the OR operator. This results in the same logic as having multiple instances of the same condition, where each has a single value. The following illustrations shows an example of a single condition with multiple values and an example of multiple conditions (for the same property) with a single value. Both examples result in the same query: (kind="email") OR (kind="contacts") OR (kind="meetings")

    One condition with multiple values

    Multiple search conditions for the same property

Tip

If a condition accepts multiple values, we recommend that you use a single condition and specify multiple values (separated by commas or semi-colons). This helps ensure the query logic that's applied is what you intend.

Return to top

Examples of using conditions in search queries

The following examples show the GUI-based version of a search query with conditions, the search query syntax that is displayed in the details pane of the selected search (which is also returned by the Get-ComplianceSearch cmdlet), and the logic of the corresponding KQL query.

Example 1

This example returns email items that contain the keyword "report", were sent before April 1, 2015, and that contain the word "northwind" in the subject field.

GUI

First example of search conditions

Search query syntax

report‎(c:c)‎‎(date<2015-04-01)‎‎(subject:"northwind")‎

Search query logic

report AND (date<2015-04-01) AND (subject:"northwind")

Return to top

Example 2

This example returns email messages or calendar meetings that were sent between 12/1/2014 and 11/30/2015 and that contain words that start with "phone" or "smartphone".

GUI

Second example of search conditions

Search query syntax

phone* OR smartphone*‎(c:c)‎‎(sent=2014-12-01..2015-11-30)‎‎(kind="email")‎‎(kind="meetings")‎

Search query logic

phone* OR smartphone*‎ AND ‎‎(sent=2014-12-01..2015-11-30)‎ AND (‎‎(kind="email") OR ‎‎(kind="meetings"))

Return to top

Search tips and tricks

  • Keyword searches are not case sensitive. For example, cat and CAT return the same results.

  • The Boolean operators AND, OR, NOT, NEAR, and ONEAR must be uppercase.

  • A space between two keywords or two property:value expressions is the same as using AND. For example, from:"Sara Davis" subject:reorganization returns all messages sent by Sara Davis that contain the word reorganization in the subject line.

  • Use syntax that matches the property:value format. Values are not case-sensitive, and they can’t have a space after the operator. If there is a space, your intended value will just be a full-text search. For example to: pilarp searches for "pilarp" as a keyword, rather than for messages that were sent to pilarp.

  • When searching a recipient property, such as To, From, Cc, or Recipients, you can use an SMTP address, alias, or display name to denote a recipient. For example, you can use pilarp@contoso.com, pilarp, or "Pilar Pinilla".

  • You can use only prefix wildcard searches; for example, cat* or set*. Suffix wildcard searches (*cat) or substring wildcard searches (*cat*) aren’t supported.

  • When searching a property, use double quotation marks (" ") if the search value consists of multiple words. For example subject:budget Q1 returns messages that contain budget in the in the subject line and that contain Q1 anywhere in the message or in any of the message properties. Using subject:"budget Q1" returns all messages that contain budget Q1 in the subject line.

  • To exclude content marked with a certain property value from your search results, place a minus sign (-) before the name of the property. For example, -from:"Sara Davis” will exclude any messages sent by Sara Davis.

Return to top