CloudStacking.com | Stacking solutions in the cloud for fun and profit

Configuring Explorer's Sendto Shortcut to ThinApped Outlook

Introduction

As the goal of Application Virtualization is to decouple the application from the underlying Operating System, we often find ourselves lacking this lost integration in unexpected places. One issue I frequently face with customers is how to configure Windows Explorer’s Sendto shortcut (the one available when you right-click on a file) to actually work with a ThinApped copy of Microsoft Outlook.

To thinreg or not to thinreg?

ThinApp’s method of integrating itself into the OS is via a tool called thinreg.exe - but before we discuss why isn’t it suitable for this particular task we need to understand what it does do: When we create a ThinApp package, we are essentially creating a self-contained application “bubble” which can have any number of “Entry Points” - these Entry Points usually represent the individual sub-components of the application that we want to expose to the user (and as they share the same bubble, they share files, registry and configuration with each other).

In the case of Microsoft Office, we typically want to create an Entry Point for each of the suite’s programs such as: Word, Outlook, Excel and Powerpoint - and the configuration of the Entry Points is captured by the ThinApp composer and placed into the package.ini file.

Let’s go over the output of the outlook.exe entry point as captured in a default Office installation, with the sections that interest us bolded:

[Microsoft Office Outlook 2007.exe]
Source=%ProgramFilesDir%\Microsoft Office\Office12\OUTLOOK.EXE
Shortcut=Microsoft Office Enterprise 2007.dat
Icon=%SystemRoot%\Installer{90120000-0030-0000-0000-0000000FF1CE}\outicon.exe
FileTypes=.hol.ibc.ics.msg.oft.vcf.vcs
Protocols=feed;feeds;mailto;Outlook.URL.feed;Outlook.URL.mailto;Outlook.URL.stssync;Outlook.URL.webcal;outlookfeed;outlookfeeds;stssync;webcal;webcals ObjectTypes=DOCSITE.DocSiteControl.1;MailMsgAtt;Outlook.Application;Outlook.Application.12;Outlook.FileAttach;Outlook.MsgAttach;Outlook.OlkBusinessCardControl;Outlook.OlkBusinessCardControl.1;Outlook.OlkCategoryStrip;Outlook.OlkCategoryStrip.1;Outlook.OlkCheckBox;Outlook.OlkCheckBox.1;Outlook.OlkComboBox;Outlook.OlkComboBox.1;Outlook.OlkCommandButton;Outlook.OlkCommandButton.1;Outlook.OlkContactPhoto;Outlook.OlkContactPhoto.1;Outlook.OlkDateControl;Outlook.OlkDateControl.1;Outlook.OlkFrameHeader;Outlook.OlkFrameHeader.1;Outlook.OlkInfoBar;Outlook.OlkInfoBar.1;Outlook.OlkLabel;Outlook.OlkLabel.1;Outlook.OlkListBox;Outlook.OlkListBox.1;Outlook.OlkOptionButton;Outlook.OlkOptionButton.1;Outlook.OlkPageControl;Outlook.OlkPageControl.1;Outlook.OlkSenderPhoto;Outlook.OlkSenderPhoto.1;Outlook.OlkTextBox;Outlook.OlkTextBox.1;Outlook.OlkTimeControl;Outlook.OlkTimeControl.1;Outlook.OlkTimeZone;Outlook.OlkTimeZone.1;RECIP.RecipCtl.1
Shortcuts=%Programs%\Microsoft Office

These parameters interest us because they define the specifics of how to register with the underlying physical OS.
“FileTypes” indicates what file suffixes will be associated with this Entry Point.
“Protocols” is the association with Internet Explorer URL path suffixes (using http and https has become such a second nature to us, that we tend to forget that we can also browse to other types of addresses such using the same Explorer such as ftp).
“ObjectTypes” registers COM objects from ThinApp in the underlying COM Provider.
“Shortcuts” is the list of the locations in which to place a shortcut to start the Entry Point (such as the user’s Desktop and Programs).

So far so good, but what about the Sendto?

As we’ve learned in the previous section, the functionality to enable Sendto context menu simply doesn’t exist in thinreg - but hope is not lost! We can still manually (or via script) configure the host’s “Send to mail recipient” short cut so that instead of trying to locate a physical installation of a mail client - it will immediately launch our ThinApped Outlook instead.

First, we will need to locate and delete the existing Sendto link (aptly named “mail recipient.MAPIMail”), located under %userprofile%\sendto and create a new shortcut to the path shortcut invoking the following command:

Outlook 2007:

“C:\Path to ThinApp\Outlook.exe” /c ipm.note /a

Outlook 2003:

“C:\Path to ThinApp\Outlook.exe” /c ipm.note

Enough talking - just hand over the answer!

For the sake of practicality, below is a VBScript which will replace the original “mail recipient” with one invoking your ThinApped Outlook. Just copy the text and paste it into a .vbs file and execute the script in the user’s behalf via logon script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
' First, we set the path for the ThinApped Outlook
OutlookPath = "C:\ThinApp\Outlook 2007.exe /c ipm.note /a"

' Don't forget to use these arguments for Outlook 2003
'set OutlookPath = "C:\ThinApp\Outlook 2003.exe /c ipm.note"

' Initialize the necessary objects
set WshShell = WScript.CreateObject("WScript.Shell")
Set objEnv = WshShell.Environment("Process")
SendTo = objEnv("userprofile") & "\sendto"

' Delete the original "mail recipient" as well as any previous "mail recipient" created by a previous run of this script
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(SendTo & "\Mail Recipient.MAPIMail") Then
 filesys.DeleteFile SendTo & "\Mail Recipient.MAPIMail"
End If 

If filesys.FileExists(SendTo & "\Mail Recipient.lnk") Then <br>
 filesys.DeleteFile SendTo & "\Mail Recipient.lnk" <br>
End If 

set oShortCutLink = WshShell.CreateShortcut(SendTo & "\Mail Recipient.lnk")
oShortCutLink.TargetPath = OutlookPath
oShortCutLink.WindowStyle = 1
oShortCutLink.Hotkey = "CTRL+SHIFT+N"
oShortCutLink.Description = "Send mail via ThinApped Outlook"
oShortCutLink.Save