How To Tame Windows 7 and Outlook Search Syntax–Knowing The Syntax Makes All The Difference
Search Simply Will Not Do What I Want It To Do!!!!
Almost ashamed to say I was looking for some file on my laptop but could not find the exact query set I needed to work with. I was looking for all of my Camtasia recording and project files. It was pretty easy to get all of any one of the types of files. All I had to do for that is search on the extension. In the case of Project files it was .camproj and in the case of recording files it was .camrec. If I entered either of these in the search from Windows-F or the top of Explorer it gave me all the files of that type. I really wanted to look at both the project files and the recording files in the same window so I could sort, compare dates, etc. Well, one would think this is a pretty easy task. I tried:
- .camrec => displayed all .camrec files
- .camproj => displayed all .camproj files
- .camrec, .camproj => no results
- .camrec or .camproj => no results
- “.camrec” “.camproj” => no results
- I think you get the picture… I tried many more things to get both files and none came up.
Now I really needed this list so I turned to Bing to find the answer. Yes, as expected, it was there. However it was buried beneath a few drill downs before I found what I was looking for. In an attempt for me to have easy access to the proper syntax of the Windows Search for Windows 7 and to provide you with the solution without having to do a bunch of digging, I decided to do a detailed blog post on Windows 7 Search Syntax.
It appears that Outlook 2010 syntax is the same as Windows 7 Search
Windows 7 Syntax – Everything You Need To Know About Searching in Windows 7 Explorer or Windows 7 Search
For Starters Let me share the solution to my problem. I found the solution in an MSDN post on Advanced Query Syntax. I needed to use an “OR” between the two search phases. In my case I had to search on [ .camrec OR .camproj ] and YES the OR IS CASE SENSITIVE! Notice above I did try “or” but I had it lower case so it did not work. I guess it was looking for all three phrases which did not appear.
Now with that problem solved let’s look at the Windows 7 Syntax in Detail…
A search query can include one or more keywords, with Boolean operators and optional criteria. These optional criteria can narrow a search based on the following:
The optional criteria, described in greater detail following, use the following syntax:
Suppose a user wants to search for a document containing the phase "last quarter," created by John or Joanne, and that the user saved to the folder mydocuments. The query may look like this:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Users can also limit their searches to specific types of files, called file kinds. The following table lists the file kinds and offers examples of the syntax used to search for these kinds of files. |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Users can search on specific properties of different file kinds. Some properties (like file size) are common to all files, while others are limited to a specific kind. Slide count, for example, is specific to presentations. The following tables list these properties by file kind. These are properties common to all file kinds. To include all types of files in a query, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Search keywords and file properties can be combined to broaden or narrow a search with operators. The following table explains common operators used in a search query. LOOK => This is the one that solved my problem Note The operators AND, NOT and OR must be in uppercase and cannot be combined in one query (e.g., |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In addition to searching on specific dates and date ranges using the operators described earlier, AQS allows relative date values (like specify a date range, type the property followed by two dates. For example, type from:david sent:11/05/06..11/05/07. Windows Search recognizes all Windows date formats and also recognizes the following values:
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to attachments. To limit the search to attachments only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to contacts. To limit the search to contacts only, the syntax is:
where Note Phone numbers are indexed as entered. For example, if a user did not include a country or area code when entering the phone number, users will not be able to locate a contact if searching with country or area code in the phone number. |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to communications. To limit the search to communications only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to calendars. To limit the search to calendars only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to documents. To limit the search to documents only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to presentations. To limit the search to presentations only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to music files. To limit the search to music only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to pictures. To limit the search to pictures only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
These are properties common to videos. To limit the search to videos only, the syntax is:
where |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There is a Windows Search Overview page at: Windows Search Overview
More information available for using Advance Query Syntax Programmatically at Using Advanced Query Syntax Programmatically
Comments
Anonymous
December 09, 2011
Absolutely wonderful. got my search to work thanks to this. Needed to search a set of folders in outlook in a set date bracket and not display the attachments. Thanks!Anonymous
January 09, 2012
I have seen a lot about complicated searches but nothing explaining my problem. I have a lot of files with names containing the string 2.6 but Windows Search will not find any of them. What is the problem. Thanks! -- Dan Hi Bruce, Thanks for the feedback. Try enclosing your string in quotes "2.6" this should workAnonymous
November 09, 2012
GREAT blog. I consider myself "gifted in the art of windows search" but even I learned a few valuable tips from what you listed here. My main issue now is -- how do I recall previous searches from history to modify? I'm used to unix/cygwin or DOS where up-arrow will recall previous commands so you can edit them, tweak, modify, improve, etc. I find in searching that I'll craft some lengthly search syntax, find an item and then upon realizing it's not what I was looking for, I had to re-type in the search phrase. I know I can just press [enter] and bring up the windows-explorer-based version of search, where it keeps the search string in the upper right hand corner so I can modify, but I'd really like a history key to bring up previous search phrases. If you know it, let me know!Anonymous
February 14, 2013
In Outlook 2010 I need to search mail items for #02. So I enter "#02" in the Instant Search. What are my results?! Any mail item containg "02" or could be "<any number>02". Everywhere I look sites say throw a phrase in quotes to find exact match, but that obviously is not true, and I haven't seen any site saying the pound key ('#') has any special significance. Anyone have any idea how to search for "#02" in Outlook? Please help! ThanksAnonymous
October 20, 2013
"social security" Finds items that contain the exact phrase social security. NOPE. Quotes make no difference, whatsoever.Anonymous
December 03, 2015
The comment has been removed