Adding the Query Builder tab to the Filter Page in Outlook 2007
Outlook has an undocumented feature to add a query builder from within the custom filter tab in custom views. This is very useful in generating search strings in automation (VBA, VSTO, .NET, etc). Build the filter, then copy and paste into your code.
To display the Query Builder page on the Filter dialog box :
-
Click Start, point to Run, type Regedit in the Run dialog box, and then click OK to launch the Windows Registry editor.
-
In the Registry tree, navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook. (for earlier versions of Outlook, change the version number from 12.0 to your version..ie 10)
-
Select New from the Edit menu, and then select Key from the New submenu.
-
Name the key: QueryBuilder.
-
Save and Close
To build a filter using the Query Builder page on the Filter dialog box
-
In Outlook, select Current View from the View menu and then select Customize Current View from the Current View submenu.
-
Click the Filter button on the View Summary dialog box.
-
Click the Query Builder page on the Filter dialog box.
-
Use the Query Builder interface to build your query. When you construct a filter, you actually build a WHERE clause without the WHERE keyword. Notice that you can use the logical AND or logical OR operator to develop the query and move clauses up or down.
-
Click the SQL page shown in Figure 11-2 on the Filter dialog box, and clear the Edit These Criteria Directly check box. Once you clear the check box, you can copy the query by selecting it and pressing Ctrl+C to copy to the Clipboard.
-
Because you don't want to modify the view, click Cancel to dismiss the Filter dialog box. Then click Cancel again to dismiss the View Summary dialog box.