- [ Team LiB ]
Open Outlook Items from the Command Line
The collection of switches covered in this section works with Outlook forms and files.
You can open a specific form or file or open a form and include an attachment or an
You can create desktop shortcuts to quickly load a form, putting them on the shortcut
Navigation Pane or create toolbar button hyperlinks.
Possible uses of these switches even include Quick Launch shortcuts to frequently used
forms or with Windows Task Scheduler to automatically create an item at a specific time.
• /a— Creates a new message with the specified file as an attachment. For example,
this command line creates a new message with report.doc attached:
• "C:\Program Files\Microsoft Office\Office11\Outlook.exe "
• /a "C:\My Documents\report.doc"
The command-line examples might be printed on two or more lines,
but when typing them in, use one line and leave a space before the
slash (/), as seen in the shorter examples.
• When you don't specify an item type, Outlook uses the IPM.Note form, which
creates a new email message. Other item types are listed in the next bullet.
• /c messageclass— Creates a new item of the specified message class:
• Outlook.exe /c IPM.Note
The default message classes included with Outlook are
/c IPM.Activity— Creates a journal entry
/c IPM.Appointment— Creates an appointment
/c IPM.Contact— Creates a contact
/c IPM.Note— Creates an email message
/c IPM.Stickynote— Creates a note
/c IPM.Task— Creates a task
Or you can use the /c switch with a custom Outlook form that you've created:
- /c IPM.Note.MyForm
See Chapter 20, "Creating Custom Forms," to learn how to create
and publish custom forms.
You can combine the /a and /c switches to open a form and add an
"C:\Program Files\Microsoft Office\Office11\Outlook.exe "
/c IPM.Note.Report /a "C:\My Documents\report.doc"
• /m emailname— Provides a way for the user to add an email address to a message.
You can use an email address or any resolvable name or distribution list in your
address book. Use it with the /c command-line parameter as in this example:
• Outlook.exe /c IPM.note /m firstname.lastname@example.org
This opens a new message form addressed to email@example.com. If you have a
contact for me in your address book, you could use "Diane Poremsky", enclosed
with quotes because the name includes a space.
Unfortunately, you can't string this switch with both the /a and /c switches. The /c
switch is required.
Use the following switches to open files stored on your computer's hard drive, not files
that are stored in Outlook's folders. In many cases, the following group of commands is
more appropriate to use to programmatically use a feature, rather than for regular use.
The format of the command line needed for these switches is similar to this:
Outlook.exe /f "C:\My Documents\savedsearch.oss"
Replace the switch and filename with the appropriate switch.
• /Embedding— Embeds the specified message file (.msg) as an OLE (Object
Linking and Embedding) object in a new message. Also used without command-
line parameters for standard OLE co-create. Use with the /c switch to create
Outlook items with embedded messages. This example creates a new contact form
with a message embedded as an OLE object:
• Outlook.exe /c IPM.Contact /Embedding "D:\Data\Account.msg"
• /f msgfilename— Opens the specified message file (.msg) or Microsoft Office
- saved search (.oss) which is in the Windows file system. Create saved search files
when you save an Advanced Find search and use the shortcut to run the search at a
• Outlook.exe /f "D:\Data\Mitchell_Project.oss"
• /hol holfilename— Opens the specified Holiday (.hol) file. Use this to add
holidays to the calendar.
• Outlook.exe /hol "D:\Data\company.hol"
• /iCal icsfilename— Opens the specified Internet Calendar (.ics) file. Use /vCal to
open vCalendar (.vcs) files.
• Outlook.exe /ical "\\Shared\Documents\Independence Day.ics"
• Outlook.exe /vcal "D:\Data\Christmas_Party.vcs"
• /l olkfilename— Opens the specified Outlook Address Book (.olk) file. Word
creates this file when you perform a mail merge using Outlook as your data
• "C:\Program Files\Microsoft Office\Office11\Outlook.exe " /l "D:\promo.olk"
• /t oftfilename— Opens the specified template (.oft) file.
• Outlook.exe /t "D:\templates\invoice.oft"
• /v vcffilename— Opens the specified vCard (.vcf) file.
• Outlook.exe /v "C:\ \\Shared\Documents\Jenny Smith.vcf"
• /x xnkfilename— Opens the specified Outlook link (.xnk) file. Links are shortcuts
to Outlook folders in your profile, created by right-clicking and dragging a folder
to the file system, and choosing Copy Here when you release the mouse button.
• Outlook.exe /x "\\Shared\Documents\Team Calendar.xnk"
[ Team LiB ]