How to Use KQL Syntax in Outlook on the Web Search Bar
🔍 WiseChecker

How to Use KQL Syntax in Outlook on the Web Search Bar

Outlook on the Web includes a search bar that can do more than simple keyword lookups. You can use Keyword Query Language or KQL syntax to create precise searches that filter by sender, date, attachment type, and other message properties. Many users type basic terms and scroll through results, but KQL lets you find any email in seconds. This article explains the KQL syntax rules that work in Outlook on the Web and shows you how to build effective search queries.

Key Takeaways: KQL Search Queries in Outlook on the Web

  • from:person@example.com: Returns all messages sent by a specific email address or display name.
  • subject:quarterly report: Finds messages with those words in the subject line only.
  • hasattachment:true: Filters results to show only emails that contain one or more file attachments.

ADVERTISEMENT

What KQL Syntax Does in Outlook on the Web

Keyword Query Language is a structured query syntax used by Microsoft search technologies including SharePoint, Exchange, and Outlook on the Web. When you type a query into the Outlook on the Web search bar, the server parses the text and applies property filters before returning results. Unlike plain text search that scans every word in the message body and metadata, KQL limits the scan to specific fields. This reduces the number of irrelevant results and speeds up the search process.

Outlook on the Web supports KQL properties for common email fields. These include from for the sender, to for the recipient, subject for the subject line, hasattachment for attachment presence, and received for date filtering. You can combine multiple property filters in a single query using AND, OR, and NOT operators. The search bar also supports quotation marks for exact phrase matching and parentheses for grouping conditions.

No special setup or add-in is required. KQL works in the standard search bar at the top of the Outlook on the Web interface. The syntax is case-insensitive, so FROM:john and from:John return the same results. Date values must use a specific format, and attachment filters use Boolean true or false values.

How to Build KQL Search Queries in Outlook on the Web

Open Outlook on the Web in any modern browser. The search bar is located at the top center of the window. Click inside the search bar and type your KQL query. Press Enter to execute the search. Results appear in the main message list below the search bar.

The following steps cover the most common KQL property filters you can use. Each step shows the syntax and an example.

  1. Search by sender using the from property
    Type from:name or email address in the search bar. For example, from:jane.doe@company.com returns all messages sent by Jane Doe. You can also use a partial display name such as from:Jane to match any sender whose display name starts with Jane. The from filter matches the display name and the email address stored in the From field.
  2. Search by recipient using the to property
    Type to:name or email address. For example, to:support@company.com returns messages where the specified address appears in the To field. The to filter does not include recipients in the CC or BCC fields. To search CC recipients, use the property cc:name.
  3. Search by subject using the subject property
    Type subject:keyword or phrase. For example, subject:budget returns messages with the word budget in the subject line. To match an exact phrase, use quotation marks: subject:”quarterly review” returns messages with exactly quarterly review in the subject.
  4. Filter by attachment using hasattachment
    Type hasattachment:true to show only messages with attachments. Type hasattachment:false to show only messages without attachments. This filter is Boolean and does not accept other values.
  5. Filter by date using the received property
    Type received:date in one of these formats: received:2024-01-15 for a specific date, received:>2024-01-01 for messages after a date, received:<2024-06-01 for messages before a date, or received:2024-01-01..2024-01-31 for a date range. The date format is YYYY-MM-DD. You can also use relative dates such as received:today, received:yesterday, or received:this week.
  6. Combine multiple properties with Boolean operators
    Use AND, OR, and NOT to join conditions. For example, from:jane AND hasattachment:true returns messages from Jane that have attachments. subject:report OR subject:summary returns messages with either word in the subject. from:jane NOT hasattachment:true returns messages from Jane without attachments. The operators must be uppercase. You can use parentheses for grouping: (from:jane OR from:john) AND hasattachment:true.
  7. Search for exact phrases with quotation marks
    Wrap a multi-word phrase in double quotation marks to search for that exact sequence. For example, “meeting canceled” returns messages containing the exact phrase meeting canceled. This works in the body, subject, and other text fields.

ADVERTISEMENT

Common Mistakes When Using KQL in Outlook on the Web

KQL query returns no results

The most common cause is a typo in the property name or value. Verify that the property name is lowercase and followed by a colon with no space. For example, from :jane with a space before the colon is invalid. Also confirm that the date format is YYYY-MM-DD and that the email address or display name is correct. If you use a partial name, ensure it matches the beginning of the display name or email address.

Boolean operators do not work as expected

Boolean operators must be uppercase and placed between property filters. The query from:jane and hasattachment:true fails because and is lowercase. Use from:jane AND hasattachment:true instead. Also avoid mixing plain text with property filters without operators. For example, from:jane budget may treat budget as a separate text search term. Use from:jane AND budget to combine them correctly.

hasattachment filter returns inconsistent results

The hasattachment filter only detects files attached to the message. It does not detect inline images embedded in the message body or attachments on calendar items. If you need to find messages with specific file types, you cannot use a KQL property for file extension in Outlook on the Web. Use the general text search with the file extension instead, such as .pdf.

Date range query returns messages outside the range

The double-dot range syntax uses two periods with no spaces. The query received:2024-01-01 .. 2024-01-31 with spaces around the periods is invalid. Write it as received:2024-01-01..2024-01-31. Also note that the range is inclusive on both ends.

KQL Property Filters vs Plain Text Search in Outlook on the Web

Item KQL Property Filters Plain Text Search
Search scope Specific fields such as From, Subject, or Received date All indexed fields including body, subject, sender, and attachments
Precision High — returns only items matching the specified field Low — returns any item containing the keyword anywhere
Date filtering Supported with received property and range syntax Not supported natively without clicking the filter button
Attachment filtering Supported with hasattachment:true or false Not supported natively
Boolean operators AND, OR, NOT supported Not supported — all terms are implicitly AND
Exact phrase matching Supported with double quotation marks Supported with double quotation marks
Learning curve Moderate — requires memorizing property names and syntax Low — works like any web search engine

You can now use KQL syntax in Outlook on the Web to find emails by sender, recipient, subject, attachment status, and date range. Try combining the from property with hasattachment:true to locate files from a specific person. For advanced filtering, use the received property with a date range and the AND operator to narrow results further. Remember that property names are case-insensitive but must be followed by a colon with no space.

ADVERTISEMENT