» Home

  » Plugins

      » Outlooker

Brass Plugins: Outlooker

The Query Builder

Outlook usually contains a lot of data. Most of it you don't want to see. The Query Builder is how you define the bits you do.

 

The principle behind the query builder is simple. Select the field you want to filter your data on from the "Field" drop down. Select the condition you want to check, and the value it should meet. Click "Add this query" and you're done. It works on exactly the same principle as the Outlook advanced find system.

Here's a practical example. If you wanted to see all the emails you received with a subject of "Brass" you would select "Subject" from the "Field" dropdown, "is equal to" from the condition drop down, and type "Brass" into the value field. Click "Add this query", and you're done.

Some fields can only accept specific values. Select "Importance" from the "Field" dropdown, and you'll see the value text field changes to a dropdown. Because there are only 3 levels of importance available in Outlook, the query builder helps you to select the option you want.

Depending on the folder the query is for, you will see different items in the "Field" dropdown. For example, you'll see "Percentage Complete" for a task folder but not for an email folder.

 

Compound Queries

Queries can be linked together using the "And", "And Not" and "Or" directives. If you wanted to see all emails with a subject of "Brass" and received today, you could use a query such as:

[Subject] = "Brass" And [ReceivedTime] {Today}

Simply select your first query and click "Add this query", then select your second query and click "Add this query" again. The "And" directive will be automatically added for you. If you want to use an "Or" / "And Not" query, you must manually edit the full query field.

 

Variable Entries

Sometimes you'll need to use a variable in a query. A good example here is a date field. If you want to see all the emails you received today you could type today's date into the value field. Of course when tomorrow comes around, you'll be looking at yesterday's emails instead. Think about that for a second ;-)

Outlooker supports variables in queries. Instead of entering today's date, you can use "{Today}" in its place. That way you'll always see the current day's emails, rather than those on a fixed date.

Some of the supported variables include "{Today}", "{Yesterday}" and "{Next X Days}" where X is the number of days to use (eg: "{Next 7 Days}".

Select one of the date options ("Received", "Sent" etc) and click on the condition dropdown to see the available options.

Outlooker also supports "search inside". This feature isn't even supported by Outlook! When you are filtering on a text field such as email address or subject you can use the "(Contains)" directive. Brass will then search inside every item to find ones that match your criteria. The "(Contains)" and "(Begins With)" options appear automatically in the "Condition" field when they are available.

 

Advanced Users Only - The "Show Enumerated Fields" checkbox

I'll be honest, Outlook is a total pain to work with. The search and query fields it provides aren't particularly obvious and don't always make sense. Outlooker tries to make this easier by providing English names for the fields - "Received" instead of "[ReceivedTime]". These names are not provided by Outlook, it's just what we (the Brass developers) know the fields to be used for (or our best guess).

Some of the fields are so cryptic it's not obvious what they are. I'm sure there are some Outlook experts out there who will know, and who might want to access them. That's why Outlooker provides the field enumeration system.

Here comes the science part. When Outlooker starts up, it enumerates all the properties available for mail, task, note, calendar and contact items directly from within something called the Outlook Type Library. This is a link to the internal workings of Outlook. Because Outlooker enumerates the properties directly from the type library it will always display the latest, most complete set of properties it can find.

Lots of other Outlook add-ins use predefined lists of properties that have been hard-coded into the add-in. That means whenever Outlook is updated to include new features, the add-ins have to be manually updated too. Outlooker doesn't have this problem when "Show enumerated fields" is checked.

When checked, Outlooker displays the actual fields as retrieved from the type library in the "Fields" dropdown.

You can browse these fields in a different way through the Outlook Visual Basic Macro system. Open Outlook and go to the Visual Basic Editor (usually Tools menu - Macro - Visual Basic). Press F2 and the Outlook VBA browser appears. The items to look at are MailItem, TaskItem, ContactItem, NoteItem and AppointmentItem.

 

Very Advanced Users Only - Manual Query Input

Outlook has another fancy feature it doesn't advertise much. It's possible to add custom fields to Outlook, so you can store your own data along with all the standard items. Most users don't bother with this, but lots of Outlook add-ins do.

For example, if you have an Outlook spam manager add-in, it might add a "Spam Score" custom field to all email items. You might then want to filter your email based on this spam score field.

Because this is a non-standard field and not part of the Outlook type library, Outlooker has no way to know about this field. In this case you can type the query directly into the full query edit box. If Outlooker detects that you specified an invalid query (it can only know this at run-time when it passes the request to Outlook and gets an invalid response back), a messagebox will appear.