Starting Custom Applications from the Lync 2010 User Interface

Summary:   This article describes how to add custom commands to Microsoft Lync 2010 menus, use the custom command to start an application, and then return SIP URIs to the application.

Applies to:   Microsoft Lync 2010 SDK | Microsoft Lync 2010

Published:   April 2011 | Provided by:   John Clarkson, Microsoft | About the Author

Contents

  • Introduction

  • Start a Custom Application from the Lync 2010 UI

  • Start an Executable or a Web Application

  • Choose From Five Different Locations to Position Your Custom Command

  • Use Your Custom Application in Two-Party or Multi-Party Sessions

  • Return User Identity in Your Custom Application

  • Conclusion

  • Additional Resources

Introduction

The Microsoft Lync 2010 UI can be extended by adding custom commands to contact cards or menus. Use these custom commands to start your own applications, whether they are executable or HTTP protocol applications. You can start your application in a local session, in a one-on-one with a partner, or in a multi-party session. You can also return the SIP URI of the user who is signed in to Lync 2010, or return the SIP URI of any selected Lync 2010 contacts.

Start a Custom Application from the Lync 2010 UI

Once you have created an application, you only have to use the Windows registry to register it. To keep things simple let's assume the application is an executable program that already exists, and you only want to add it to the Lync 2010 UI and be able to start it. All that you have to do is assign a GUID to your application and then add a Windows registry subkey at one of the following locations:

  • For 64-bit operating systems: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Communicator\SessionManager\Apps

  • For 32-bit operating systems: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Communicator\SessionManager\Apps

A sample 32-bit subkey appears in the following example.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Communicator\SessionManager\Apps\{3B3AAC0C-046A-4161-A44F-578B813E0BCF}]
"Name"="UCode2"
"Path"="C:\\Sample.exe"

Note

Modify the Path value to match the .exe file path. This registry subkey excludes values that are added later in this article. For more information about Windows registry values that support this feature, see Add Custom Commands to Lync Menus.

After adding the subkey, sign out, and then sign back in to Lync 2010. The custom command appears at two locations:

  • Right-click a contact in the contacts area, and then click the custom command that appears in the shortcut menu.

  • In the conversation window menu bar, click Actions, and then click the custom command that appears in the Actions menu.

Start an Executable or a Web Application

The following example is a basic HTML page that can be used to create a web application.

<html>
<head>
</head>
<body>
<p>Text in an HTML paragraph element</p>
</body>
</html>

In the following registry subkey example, the ApplicationType value is used to specify that this application is an HTTP protocol application. Update the Path value to match the name of your HTML source page.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Communicator\SessionManager\Apps\{3B3AAC0C-046A-4161-A44F-578B813E0BCF}]
"Name"="UCode2"
"Path"="https://localhost/Sample.html"
"ApplicationType"=dword:00000001”

Start the web application from the UI in the same manner as the executable in the previous section. The next section describes the other locations that can be used to position custom commands in the Lync 2010 UI.

Choose From Five Different Locations to Position Your Custom Command

Use the registry value ExtensibleMenu to select where the custom menu appears. ExtensibleMenu may contain a single item, or a semicolon-delimited list of items. So far in this article we have not defined ExtensibleMenu, so the default values of MainWindowRightClick and ConversationWindowActions are used. The following table describes the five items that you can add to ExtensibleMenu.

ExtensibleMenu value

Action

Example

MainWindowActions

In Lync 2010, click the down arrow, point to Tools, and then click the custom command.

MainWindowActions

MainWindowRightClick

In the Contacts list or search results, right-click a contact, and then click the custom command.

MainWindowRightclick

ConversationWindowActions

In the Lync conversation window menu bar, click Actions, and then click the custom command.

ConversationWindowActions

ConversationWindowRightClick

In the Lync conversation window, click the People Options button, click Show Participant List, right-click a contact name, and then click the custom command.

ConversatuionWindowRightclick

ContactCardMenu

In the Contact Card options menu, click the custom command.

ContactCardMenu

A registry subkey that lists all five of the ExtensibleMenu values appears in the following example.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Communicator\SessionManager\Apps\{3B3AAC0C-046A-4161-A44F-578B813E0BCF}]
"Name"="UCode2"
"Path"="C:\\\\Sample.exe"
"ApplicationType"=dword:00000000
"ExtensibleMenu"="MainWindowActions;MainWindowRightClick;ConversationWindowActions;ConversationWindowRightClick;ContactCardMenu"

Use Your Custom Application in Two-Party or Multi-Party Sessions

This section describes how to configure a custom application for two-party or multi-party sessions.

To Configure a Two-Party Session

  1. Install your custom application on two computers.

  2. Add Windows registry subkeys to each computer. One unique application GUID must be used on each computer.

    Important

    The SessionType value appearing in the next example must appear in each two-session computer registry subkey. SessionType determines whether the application can run on one computer or run on multiple computers. For the two-party session, set the SessionType value to 1 on the computers that are used in step 1.

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Communicator\SessionManager\Apps\{3B3AAC0C-046A-4161-A44F-578B813E0BCF}]
    "Name"="UCode2"
    "Path"="C:\\\\Sample.exe"
    "SessionType"=dword:00000001
    "ApplicationType"=dword:00000000
    "ExtensibleMenu"="MainWindowActions"
    
  3. On both computers, sign out and then sign in to Lync to refresh the Lync registry pool.

  4. On the first computer, right-click a Contact Card, and then click the custom command to start the custom application.

  5. On the second computer, click the desktop alert. In the Group Conversation (2 Participants) conversation window, click Accept to start the application.

    Figure 6. Group conversation with two participants

    Group conversation

To Configure a Multi-Party Session

  1. Use the previous procedure to configure the first two computers, and then use the following steps to configure each additional computer.

  2. On each additional computer, install the custom application and add a Windows registry subkey as described earlier.

  3. Set the SessionType value to 2 on each computer that joins the session.

  4. As needed, sign out and then sign in to Lync to refresh the Lync registry pool.

  5. On the first computer, select two contact cards, right-click the contact cards, and then click the custom command.

  6. On each of the other computers, click the desktop alert. In the Group Conversation conversation window, click Accept to start the custom application.

    Figure 7. Group conversation with three participants

    Group conversation

Return User Identity in Your Custom Application

The two optional parameters that appear in the following table can be added to the Path value to return the identity of users or contacts.

Application type

Example Path value in Windows registry

Executable

c:\\Sample.exe /userId=%user-id% /contactId=%contact-id%

Protocol

https://localhost/Test/Sample.html?userId=%user-id%&contactId=%contact-id%

After the registry settings are set, the user and contact information is added to the Lync registry pool. To collect user and contact information data, add appropriate code to the custom application. For example, in a .NET Framework application you can use the Environment.GetCommandLineArgs method. In a JavaScript application, you can use the window.location.search property.

Conclusion

Use Windows registry subkeys and values to add and configure custom applications in the Lync 2010 user interface. You can also configure a custom application to run in a multi-user conversation, and return user or contact IDs.

Additional Resources

For more information, see the following resources:

About the Author

John Clarkson is a programming writer with the Microsoft Lync product team.