Instant Search query commands reference

Starting in Outlook 2007, and continued in Outlook 2010, the Search function in Outlook can integrate with the default Windows Search Indexer of Windows Vista and Windows 7 or when you have Windows Search installed when using Windows XP.

As this is an indexed search, this allows for faster search query results than with the traditional built-in Search function in Outlook. With this change, you also have access to a lot of special search commands and index fields to refine your search.

While many of the commands and fields can also be found and selected directly within Outlook, not all of them are exposed. Additionally, you’ll have to type these commands or field names manually when searching for Outlook content via the Windows Search box outside of Outlook.

This is a reference guide to the available search operators and search fields and how to use them.


Dates

To find items based on their primary date field, you can use the before: and after: command. This usually corresponds with either when the message or other Outlook item was received, sent, created or modified. Behind this command follows a date statement that matches with the date format you have configured in Windows.

Examples:
When using the date format mm/dd/yyyy
before:1/27/2010

When using the date format dd-mm-yyyy
before:27-1-2010

Aside from the date format, you can also use words to calculate a relative date on the fly or to directly specify a date or month;

  • Direct searches relative from today;
    Today, tomorrow, yesterday
  • Combination searches relative from today;
    Use; this, next, last, past, coming
    With; week, month, year
    For instance; thisweek, nextmonth, lastweek, pastmonth, comingyear
  • Search for results on a specific day of the week;
    Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
  • Search for results in a specific months of the year;
    January, February, March, April, May, June, July, August, September, October, November, December
    You can combine this with years as well; January2010, December2009, June2006

Examples:
When using the before: or after: command;
before:June2006
after:lastmonth

See the Ranges section on how to search for items within a specific date range.

Sizes

If you are looking for items with a specific size, then you can use the size: command. When using this command, you should not forget to include the unit of size such as KB or MB.

There are a couple of words that are direct references to a specific size range;

  • Empty: 0KB
  • Tiny: 0 – 10KB
  • Small: 10 – 100KB
  • Medium: 100KB – 1MB
  • Large: 1 – 16MB
  • Huge: 16 – 128MB
  • Gigantic: >128MB

Examples:
To find all files that are exactly 5MB in size (5120KB);
size:5MB

To find all files between 1MB and 16MB;
size:large

See the Ranges section on how to search between other size ranges.

Ranges

To search in a specific date range, you could use both after: and before: commands but there is a more direct way to do this as well. The same is true for any field that allows to be searched in a specific range such as the size, sent, received and modified fields. For this you can use the following special operators between the command and its values.

Operator Examples Results
< size:<5MB
received:<lastweek
received:<12/31/2009
received:<31-12-2009
Returns results that are either smaller than or happened before the specified value. The value itself is not included.
=< size:<=5MB
received:=<lastweek
received:=<12/31/2009
received:=<31-12-2009
Returns results that either have the same size or are smaller than or happened on or before the specified value. In other words; the value itself is included.
> size:>5MB
received:>November2009
received:>11/1/2009
received:>1-11-2009
Returns results that are either larger than or happened after the specified value. The value itself is not included.
=> size:=>5MB
received:=>November2009
received:=>11/1/2009
received:=>1-11-2009
Returns results that either have the same size or are larger than or happened on or after the specified value. In other words; the value itself is included.
.. size:5MB..10MB
received:lastweek..1/1/2010
received:May2009..July2009
received:12-4-2009..17-6-2009
Return results that have a size between or happened between the specified values. The values itself are included as well.

 

Note:
Instead of using the two dots, you can also use a combination of the >= and <= operators;
size:>=5MB<=10MB is the same as size:5MB..10MB

To exclude the specified value you can use the > and < operators;
size:>5MB<10MB

Other search operators and special values

Aside from operators to search through ranges, there are also some other operators and special values available which you can use in your search queries.

NOT operator

If you want to exclude certain search results, you can use the NOT operator;
NOT category:blue

OR operator

By default you will be searching with the AND operator which you do not have to specify in your search. You can use the OR operator if you want your search results to also include items for which only a single condition is met;
contents:presentation OR attachment:presentation

[ ] operator / Search for empty fields

If you want to find an item for which a certain value is not set, you can use the square bracket characters;
birthday:[]

You can combine this field with the NOT operator to find items for which any value is selected. For instance, to find all items which have a category assigned to it you can use;
NOT category:[]

Note:
This way of searching only works when you are searching from within Outlook 2010.
It will work for both Outlook 2007 and Outlook 2010 when searching via the Search field in Explorer or the Start Menu of Windows 7.

Search multiple values

To search for multiple values within the same field, you can separate these values with a comma ( , ) semi-colon ( ; ) or dash ( – ) or enclose them in parenthesis characters ( );
category:blue,red
category:(blue red)

This would return only results for which both specified values are found. If only one suffices, then you’ll have to use the round brackets and the OR operator;
category:(blue OR red)

Search with spaces/Search exact string

In order to search for a string that contains spaces, you’ll have to enclose it by using double quotes;
"Microsoft Office Outlook"

Note:
Do not confuse this method with the parenthesis enclosing.

subject:"Microsoft Office Outlook"
This query returns all items that have Microsoft Office Outlook in their subject.

subject:(Microsoft Office Outlook)
This query will return all items that have Microsoft Office Outlook in their subject but not necessarily in that order. This will for instance also return the result; Outlook is part of Microsoft’s Office suite. In other words, it returns any item with a subject which contains the words Microsoft and Office and Outlook.

Search partial string

You can only search for a partial string if you know the beginning of that string. If you only type the end or middle part of the string, only results that begin with that part will be returned.
For instance, if you were to look for my last name “Sparnaaij”, then typing “sparn” will give the expected results. Only typing “naaij” will not return the correct results.

Using a common wildcard character such as * will not make any difference since wildcards are not supported. As special characters are ignored in general, searching for “naaij” or “*naaij” will return the same results.

If you need to search for a partial string, then you’ll have to use Advanced Find (CTRL+SHIFT+F) within Outlook, select the Advanced tab and enter the following query;

  • Field: body
  • Condition: contains
  • Value: naaij

Of course this works the same way when using a different field to search on such as “Subject”.

Search with special characters

As the search index is based on alphabetic characters and numbers only (a-z, 0-9), special characters such as # and / at the beginning of a word will be ignored when doing a search. This means that when you are looking for a certain code such as #hto123, any result starting with hto123 will be returned.

If you want to search for a string containing special characters, then you must place the string between quotes. If you do not do this, the special character will be replaced by a space and you’d be searching for the string left from the special character and right from the special character separately;
"hto#123"


Search Field Reference

Below you’ll find all the Outlook fields that are being included in the search index. When searching just for a specific word or phrase without specifying a field, all of these fields are included. To search for something in a specific field, you can include the command corresponding to that field. Of course you can combine these with other query commands and operators and also still include words in your query without specifying a field.

Example:
from:"Robert Sparnaaij" hasattachment:false received:>lastweek outlook

This will return all items containing outlook in any field but it has to be from Robert Sparnaaij, it should not have an attachment (so the search indexer will not look in any attachments for this query) and it should be received after last week.

 

Tip!
These type of queries are particularly useful when you are searching from the Search box in the Windows Start Menu or Explorer Search box. You can also save these queries as templates so you can reuse them later or further narrow down the search with just a single additional query.

To search in Outlook from the Start Menu type; store:mapi
To search in Outlook from the Explorer Search box, double click on Microsoft Outlook in your user’s Searches folder;
• Start-> click on your username in the top right-> Searches-> Microsoft Outlook

E-mail

The following e-mail fields can be searched;

Field Command Example
Attachments hasattachment,
hasattachments
hasattachment:true
Attachment Contains attachments, attachment attachment:presentation.ppt
attachment:(presentation content)
Bcc address bccaddress, bcc, bccname bccaddress:mike@contoso.com
Body contents contents:(presentation Monday)
Categories category category:project
Cc address ccaddress, cc ccaddress:mike@contoso.com
Due date duedate, due due:10/15/2008
Duration duration duration:>120
Expiration Date expires expires:10/15/2008
Flag hasflag, isflagged hasflag:false
Follow-up flag flagstatus
flagstatus:followup
flagstatus:unflagged
flagstatus:completed
flagstatus:followupflag
From from, organizer from:simon
Importance importance importance:low
importnace:normal
importance:high
In Folder folderpath folderpath:Inbox
Incomplete incomplete incomplete:true
Is completed iscompleted iscompleted:true
Message Size messagesize, size messagesize:large
Modified datemodified datemodified:10/15/2008
Read read, isread isread:false
Received received, sent sent:yesterday
Retention Policy retentionpolicy retentionpolicy:short
Sensitivity sensitivity sensitivity:normal
sensitivity:personal
sensitivity:private
sensitivity:confidential
Sent sent sent:10/15/2008
Sent to Another Recipient requiredattendees requiredattendees:mike@contoso.com
Start Date start start:10/15/2008
Subject subject, title subject:budget
To address toaddress, to toaddress:mike@contoso.com

Contacts

The following contact fields can be searched;

Field Command Example
Anniversary anniversary anniversary:yesterday
Assistant name assistantname assistantname:fred
Assistant’s phone assistantsphone assistantsphone:555-1234
Birthday birthday birthday:thismonth
Business Address businessaddress businessaddress:(street, postal code city)
Business Address City businesscity businesscity:redmond
Business Address Street businessstreet businessstreet:outlookway
Business home page businesshomepage businesshomepage:www.msoutlook.info
(see bug note below)
Business phone businessphone businessphone:555-4321
Business postal code businesspostalcode businesspostalcode:98052
Callback phone number callbacknumber callbacknumber:555-6789
Car phone carphone carphone:555-9876
Categories category category:project
Children children children:nico
City city city:redmond
Company company company:Microsoft
Department department department:development
E-mail emailaddress emailaddress:mike@contoso.com
First name firstname,
contactfirstname
firstname:robert
Full Name fullname fullname:(Robert Sparnaaij)
Home Address homeaddress homeaddress:(street, postal code city)
Home Address City homecity homecity:redmond
Home Address Street homestreet homestreet:outlookway
Home fax homefax homefax:555-2468
Home phone homephone homephone:555-13579
Home postal code homepostalcode homepostalcode:98052
IM address imaddress imaddress:luis@live.com
In Folder folderpath folderpath:contacts
Job title jobtitle jobtitle:manager
Last name lastname,
contactlastname
lastname:sparnaaij
Mailing Address mailingaddress mailingaddress:(street, postal code city)
Manager’s name manager manager:fernando
Mobile phone mobilephone mobilephone:555-2424
Modified datemodified datemodified:10/15/2008
Nickname nickname nickname:roady
Notes body, content, contents contents:(looking for internship)
Office officelocation officelocation:red/101
Other Address otheraddress otheraddress:(street, postal code city)
Other Address City othercity othercity:redmond
Other Address Street otherstreet otherstreet:outlookway
Other postal code otherpostalcode otherpostalcode:98052
Pager pager pager:882-8080
PO Box pobox pobox:12345
Primary Phone primaryphone primaryphone:555-1212
Profession profession profession:accountant
Spouse spouse spouse:susana
Street Address street street:outlookway
Title personaltitle personaltitle:manager
Web page webpage webpage:www.howto-outlook.com
ZIP/Postal Code postalcode postalcode:98052

Bug note – home page confusion madness:
The businesshomepage search field is wrongly mapped to the “Personal Home Page” field of the contact and thus the same as the webpage search field. However, as the “Personal Home Page” field is the field which is shown on the main contact form (labeled with: Web page address), this probably won’t be a direct issue for most.

The actual “Business Home Page” field is an additional field which can be specified in the All Fields section of a contact and is because of this bug not indexed nor searchable.

Calendar

The following Calendar fields can be searched;

Field Command Example
Attachment Contains attachtment attachment:presentation.ppt
attachment:(presentation content)
Attachments hasattachments hasattachments:yes
hasattachments:no
Body contents contents:(agenda project)
Categories category category:blue
category:[]
End end end:10/15/2008
Importance importance importance:low
importance:normal
importance:high
In Folder folderpath folderpath:calendar
Location location
meetinglocations
location:calgary
Meeting Status meetingstatus meetingstatus:accepted
meetingstatus:declined
meetingstatus:notresponded
meetingstatus:tentative
meetingstatus:organized
Modified datemodified datemodified:10/15/2008
Optional Attendees optionalattendees optionalattendees:mike
Organizer, From organizer, by, from organizer:jonas
Read read, isread read:yes
read:no
Recurring isrecurring
recurring
isrecurring:true
recurring:true
Required Attendees requiredattendees requiredattendees:mike
Resources resources resources:(room 404)
Sensitivity sensitivity sensitivity:normal
sensitivity:personal
sensitivity:private
sensitivity:confidential
Show Time As showtimeas showtimeas:free
showtimesas:tentative
showtimesas:busy
showtimesas:outofoffice
Start start start:10/15/2008
Subject subject subject:(project meeting)

Tasks

The following Task fields can be searched;

Field Command Example
Body contents contents:(fill out form)
Categories category category:blue
category:[]
Complete iscompleted iscompleted:yes
iscompleted:no
Date Completed completed completed:10/15/2008
Due Date due due:10/15/2008
In Folder folderpath folderpath:tasks
Modified datemodified datemodified:10/15/2008
Owner taskowner taskowner:mike@contoso.com
Priority priority priority:low
priority:normal
priority:high
Reminder Time remindertime remindertime:today
Start Date start start:10/15/2008
Status taskstatus taskstatus:notstarted
taskstatus:inprogress
taststatus:completed
taskstatus:waitingonsomeone
taskstatus:deferred
Subject subject subject:(holiday form)

Notes

The following Note fields can be searched;

Field Command Example
Body contents contents:(login password)
Categories category category:blue
category:[]
Color color color:blue
color:green
color:pink
color:yellow
color:white
Created datecreated datecreated:10/15/2008
In Folder folderpath folderpath:notes
Modified datemodified datemodified:10/15/2008
Subject subject subject:(user credentials)

Journal

The following Journal fields can be searched;

Field Command Example
Body contents contents:(work done)
Categories category category:blue
category:[]
Company company company:microsoft
Contact contactnames contactnames:mike@contoso.com
End end end:15/10/2008
Entry Type entrytype entrytype:(phone call)
In Folder folderpath folderpath:journal
Mileage mileage mileage:64
Modified datemodified datemodified:15/10/2008
Sensitivity sensitivity sensitivity:normal
sensitivity:personal
sensitivity:private
sensitivity:confidential
Start start start:10/15/2008
Subject subject subject:(called for project update)

Search in attachments

The indexer also indexes any attachment that is included with any Outlook item. This allows you to search within the attachments as well without needing to open them first. There are a couple of commands and tricks to search and work with attachments as optimal as possible;

If you want to search only in items that have an attachment, but not directly want to search within the attachment, you can use;
has:attachment
hasattachment:true

If you want to search in the attachments but not in the item that has the attachment itself you can use;
is:attachment
isattachment:true

If you want to search for an attachment with a specific extension you can use ext or filext;
ext:txt
filext:txt

ext:docx
filext:pdf