Outlook Search Folder: Search actual e-mail address, not Display Name
I need an Outlook Search Folder that finds e-mail by searching the sender or recipient's actual e-mail address.
It's possible to configure a Search Folder to find email based on the Sender's actual e-mail address (see below). However, it's not possible to expose the actual e-mail address for the To, Cc, or Bcc fields. An explanation of why can be found at the end of this answer.
Configure Search Folder to Search on Sender's Actual E-mail Address
Note: These instructions are written for Office 2013, but the solution should work for at least Outlook 2007 and later.
Step A: Add a Custom "Sender's Actual Address" Field to Outlook Using a Form
These steps create a custom form that adds a new field to Outlook with the sender's actual email address:
Save the following custom Outlook form configuration with the file name
FromEmailAddress.cfg
:[Description] MessageClass=IPM.Note CLSID={00020D31-0000-0000-C000-000000000046} DisplayName=From Email Address Category=Standard Subcategory=Form Comment=This forms is used to expose a sender's actual email address. LargeIcon=notel.ico SmallIcon=notes.ico VersionMajor=1 VersionMinor=0 Locale=enu Hidden=1 Owner=Microsoft [Platforms] Platform2=NTx86 Platform9=Chicago [Platform.NTx86] CPU=ix86 OSVersion=WinNT3.5 [Platform.Chicago] CPU=ix86 OSVersion=Win95 [Properties] Property01=FromEmailAddress [Property.FromEmailAddress] ;PropTag=PR_SENDER_EMAIL_ADDRESS, 0x0C1F001E Type=30 ; 001E = 30 in decimal NmidInteger=0xc1f ; 0C1F DisplayName=From E-mail Address [Verbs] Verb1=1 [Verb.1] DisplayName=&Open Code=0 Flags=0 Attribs=2 [Extensions] Extensions1=1 [Extension.1] Type=30 NmidPropset={00020D0C-0000-0000-C000-000000000046} NmidInteger=1 Value=1000000000000000
Copy the
FromEmailAddress.cfg
to your language-specific Microsoft Office's Forms folder, located at:
C:\Program Files (x86)\Microsoft Office\OfficeXX\FORMS\<LanguageID>
<OfficeXX>
is the Office folder including the version number (e.g.Office15
for Office 2013)<LanguageID>
is your 4-digit language ID (e.g.1033
for English).Note: Administrative rights are required to save files to this folder.
Note: Office may be installed inC:\Program Files
if you have a 32-bit OS, or a 64-bit version of Office on a 64-bit OS.
In Outlook, on the File tab of the ribbon click Options.
- Click Advanced in the left pane, then in the Developers group click Custom Forms...
- In the Options dialog, click Manage Forms...
- In the Forms Manager dialog, click Install...
- Navigate to the folder where you saved the
FromEmailAddress.cfg
file, select it, then click Open. - Click OK on the Form Properties window that opens, then Close, followed by OK twice to close Outlook Options.
Credit to this slipstick.com article for information on how to expose a sender's actual e-mail address as a field.
Step B: Use the Custom "From Email Address" Field in a Search Folder's Criteria
These steps leverage the newly created field as criteria for a Search Folder:
- On the Advanced tab of the Search Folder Criteria dialog box, click the Field drop-down, then click Forms...
- In the left pane select From Email Address, click Add -> then Close.
- Click the Field drop-down again, point to From Email Address then click From E-mail Address on the fly-out menu.
- Specify the desired Condition and Value, then click Add to List, then OK to close the dialog.
The Actual To, Cc, and Bcc E-Mail Addresses Can't Be Used as Criteria for Search Folders...
A thorough search of Outlook's other pre-defined fields, the MAPI fields available through Outlook's Object Model, and a review of properties exposed by OutlookSpy reveals there are no fields that expose these e-mail addresses as text. There is the PR_MESSAGE_RECIPIENTS property, but unfortunately this is an object that contains each recipient as a separate item. Accessed natively (using the Custom Form method above) returns nothing.
...With One Almost Useless Exception
Using the VBA from this slipstick.com article I was able to add a User Defined Field (UDF) to messages that contained a single string containing the recipient e-mail addresses in the format [email protected], [email protected]
. However, when selecting a UDF in the Search Folder Advanced Criteria's Field list, only UDFs defined in the Inbox are available:
If messages with the custom fields populated exist in the Inbox, they are found by the Search Folder. However, such messages located in other folders are not included in the results. Unless your Search Folder is only interested in the Inbox, this is rather useless.
Reasons why UDFs don't work in the criteria of a Search Folder are documented here, here and here.
The Pre-Defined Fields Are Still the "Best" Solution
When it comes to the To:, Cc:, and Bcc: fields, it's still best to use the pre-defined fields in your Search Folder criteria and hope the actual e-mail address is part of the Display Name (which it often is).