Command Line Parameter Changes in Outlook

As part of SP3 for Outlook 2003 (and included in SP1 for Outlook 2007) we’ve made a change to the way command line parameters are parsed to ensure Outlook is always doing the right thing.  As part of this change, a less common way of attaching files to new e-mail messages through command line parameters with Outlook may be broken in some solutions.

Previously, Outlook under some circumstances would handle an implicit command line parameter without a switch. For example, if a command line argument was provided without a switch, and was a path to a folder in the file system, Outlook would treat the argument with an implicit /select switch flag, displaying that folder in the Explorer window.  If the argument was a path to a file on the file system, Outlook would use an implicit /a switch and attach the file to a new message.

As part of making sure that our command line parameters were handled in a predictable manner, we removed the implicit logic in these service packs.  You must now explicitly specify the appropriate switch before the path to a folder to display or file to attach.  If a solution calls Outlook using an argument without a switch or with an invalid set of switches, the following error is displayed:

clip_image002

For more information on the valid command line switches that are supported by Outlook, take a look at our online documentation for command line switches.

There are a few applications that I’m aware of that have already run into this problem.  I wanted to blog about it and make sure everyone knew what was going on and how to fix a solution that no longer works as expected. Command line parameters should always be preceded by a command line switch specifying what to do with the parameter.

Edit: This change was included as part of Outlook 2007 RTM, not just SP1 as I originally stated.