How to open an Outlook contact using a Windows command-line script?

I tend to store a lot of information in the Notes fields of Outlook contacts.

Accessing this detailed info for a specific contact in Outlook 2013 requires many steps on the Windows desktop:

  • opening Outlook
  • switching to Contacts view
  • searching for the contact by name
  • opening the contact's unified "People view"
  • opening the full Outlook Contact card

As a power-user, I'd like to instead use some script:

Win-R oc John Smith

where Win-R is the shortcut to open a Run... window, and oc would be some type of script (PowerShell, VBA, Perl, ?) to directly open the detailed Outlook contact card for the given name.

Would there be any way to achieve this? Specific code would be great.

(Please note that unfortunately Outlook 2013 no longer makes its content accessible to Windows Search.)

Thanks.


Solution 1:

Powershell example to get you started:

$outlook = new-object -com Outlook.Application
$contactFolder = $outlook.session.GetDefaultFolder(10)
$contacts = $contacts.Items
$firstContact = $contacts.GetFirst()
$contact.FirstName
$contact.Email1Address

It creates a COM connection to Outlook (must be installed),
then looks up the Contacts folder (#10),
then gets all the contact Items from the folder,
then Gets the first Contact item
and finally displays that contact's First Name and primary Email Address.

More info:

  • James Manning's blog - using PowerShell for Outlook automation
  • How to retrieve contacts by using Outlook Object Model