Add custom commands to Lync menus

Beyond the basics topic

Use custom commands embedded in the Lync 2013 UI to launch applications on the Microsoft Windows desktop. Custom commands are menu items added by the developer to the Lync 2013 UI.

Applies to: Lync 2013 | Lync Server 2013

In this article
Adding custom commands
Using custom commands
Removing custom commands
Additional resources

Adding custom commands

To add a custom command for an application, add a registry subkey and the registry entries described in this topic.

Registry subkey

The subkey is the application GUID, added at the following locations:

  • For 32bit OS: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\Lync\SessionManager\Apps

  • For 64bit OS: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Lync\SessionManager\Apps

Registry entries

Under each GUID subkey, add the entries described in the following table.

Entry

Type

Description

Name

REG_SZ

The name of the application as it appears in the Lync 2013 UI.

Path

REG_SZ

The full path of the application along with parameters, including the default parameters of %user-id% and %contact-id%. The parameters pass a string representing the SIP URI of the user signed in to Lync 2013 and the selected contact or contacts to the application launched. With Path values, a shell execute command might fail because of characters that have special meaning in the shell environment. Be sure to wrap the default parameters in double quotes to avoid shell execution failure. The following examples show usage for HTML and .exe paths.

c:\\ext_menu.exe /userId=”%user-id%” /contactId=”%contact-id%”
http://localhost/Test/Sample1.html?userId=%user-id%;contactId=%contact-id%

ApplicationType

DWORD

0 = Executable, 1 = Protocol.

ApplicationInstallPath

REG_SZ

The full path of the executable, which is required if ApplicationType is 0.

SessionType

DWORD

  • 0 = local session. The application is launched on this computer.

  • 1 = two-party session. Microsoft Lync 2013 SDK launches the application locally and prompts the other user to launch the application on their computer.

  • 2 = multi-party session. Lync SDK launches the application locally and prompts the other users to launch the application on their computers.

ExtensibleMenu

REG_SZ

A semicolon-delimited list of places where the command appears. Possible values include MainWindowActions, MainWindowRightClick, ConversationWindowActions, and ConversationWindowRightClick.

If ExtensibleMenu is not defined, the default values of MainWindowRightClick and ConversationWindowActions are used.

For example, see the following Registry Editor (.reg) file results.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\Lync\SessionManager\Apps\{3E0352E8-21F3-4E00-AA46-2ADA7085C9AD}]
"Name"="Contoso Custom Application"
"ApplicationType"=dword:00000000
"ApplicationInstallPath"="C:\\ExtApp1.exe"
"Path"="C:\\ExtApp1.exe /userId=%user-id% /contactId=%contact-id%"
"SessionType"=dword:00000000
"ExtensibleMenu"="ConversationWindowRightClick;MainWindowRightClick"

Custom Parameters for the Path Registry Entry

Custom parameters %param1% through %param7% can be set for each application.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\Lync\SessionManager\Apps\{96DC330B-0A57-4A26-963B-75A109CD3C30}]
"Name"="Your Application Name "
"Path"="C:\\Program Files (x86)\\YourApplication\\ps.exe %param1%"
"ToolTip"="tooltip text"
"ApplicationType"=dword:00000000
"SessionType"=dword:00000002
"Extensiblemenu"="MainWindowActions;MainWindowRightClick;ConversationWindowActions;ConversationWindowContextual;ConversationWindowRightClick;ConversationWindowButton"

These parameters will be replaced by values added in a separate key under HKEY_CURRENT_USER as shown in the following example and passed to the recipient in the appINVITE message.

[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Lync\SessionManager\Apps\Parameters\{96DC330B-0A57-4A26-963B-75A109CD3C30}]
"param1"="256341"

Using custom commands

The following table describes how to launch an application with a given ExtensibleMenu value.

ExtensibleMenu value

Action

MainWindowActions

In the upper-right corner of the Lync 2013 conversation window, click the Show menu button, point to Tools, and then click the custom command.

MainWindowRightClick

In the conversation window, right-click a contact in the Contact List or Search Results pane, and then click the custom command.

ConversationWindowActions

In the lower-right corner of the conversation window, click the More options ellipse, point to Actions, and then click the custom command.

Retrieving SIP URIs in the custom application

To retrieve the %user-id% and %contact-id% arguments, add code to the application launched by the custom command.

static void Main(string[] args)
{
  if (null == args || args.Length == 0)
  {
    Console.WriteLine("Args is empty");
  }
  else
  {
    foreach (string arg in args)
    {
      Console.WriteLine("Arg: " + arg);
    }
  }
  Console.ReadLine();
}

Removing custom commands

Removing the GUID subkey removes the appropriate custom commands from the Lync 2013 UI.

See also

Beyond the basics: Lync 2013 SDK