Walkthrough: Perform Install Registration for an Extensibility Application (Lync 2010 SDK)

This topic shows how to use Install Registration to register a default context application, and then display that application in Microsoft Lync 2010 Conversation Window Extension. For more information about Install Registration, see Register Contextual Conversation Packages in Lync 2010.


For a list of prerequisites, see Walkthrough: Start an Instant Message Conversation (Lync 2010 SDK). In addition, you must install Internet Information Services (IIS) on the sending and receiving client computers.

Creating a Sample Context Application

The following procedure shows how to create and install an HTML page that represents a context application that is packaged in a conversation. In a production environment, substitute an application install procedure that places the application on the appropriate client computers. The context application must be installed on each sending and receiving client computer.

To create the HTML page

  1. On the sending and receiving clients, add a folder at the path Inetpub/wwwroot.

  2. Create a new .html file that uses the following HTML text.

    <p>text in an HTML paragraph element</p>
  3. Save the .html file to the folder that is created in step 1.

Adding Registry Entries

The following procedure shows how to use registry entries to register the context application with Microsoft Lync 2010. In a production environment, use a setup application or Group Policy to create these registry entries.

To register the application

  1. In Microsoft Visual Studio development system, create a GUID for the context application. For more information, see Create GUID (guidgen.exe).

  2. In the registry at HKEY_CURRENT_USER\Software\Microsoft\Communicator\ContextPackages, create a key that contains the GUID that is created in the previous step. For example:

  3. Add the following subkey/value pairs under the GUID that is added in the previous step. The values in the bottom four rows are examples. Modify these values to make them appropriate for your scenario.



















Create the Messaging Application

The following procedure shows how to create a sample application that is used to start a conversation.

To create the messaging application

  1. In the Visual Studio, create a new application. The application can be any kind of managed code application. In this procedure you create a Microsoft Windows Forms application.

  2. Add a project reference to Microsoft.Lync.Model. The default location is %ProgramFiles%\Microsoft Lync\SDK\Assemblies\WPF.

  3. In Form1.cs, add the following using statements.

    using Microsoft.Lync.Model;
    using Microsoft.Lync.Model.Extensibility;
  4. Add the following declaration to the Form class.

    ConversationWindow cWindow;
  5. Add the following code to the Form1 constructor following the InitializeComponent method.

    // Create an automation object.
    Automation myUIAuto = LyncClient.GetAutomation();
    // Conversation participant list.
    // Provide a value that is valid in your domain.
    List<string> inviteeList = new List<string>();
    // Declare a Dictionary object to pass context data.
    Dictionary<AutomationModalitySettings, object> myContextObjects = new Dictionary<AutomationModalitySettings, object>();
    // Provide conversation context: first IM message.
    string firstIMText = "hello";
    myContextObjects.Add(AutomationModalitySettings.FirstInstantMessage, firstIMText);
    // Provide conversation context: send the message immediately.
    myContextObjects.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true);
    // Provide conversation context: set the application ID
    // of the registered application providing context.
    myContextObjects.Add(AutomationModalitySettings.ApplicationId, "{40499119-4B60-45a6-9A7A-DC7A384D5670}");
    // Begin the conversation.
    IAsyncResult beginconversation = myUIAuto.BeginStartConversation(
    , inviteeList
    , myContextObjects
    , BeginConversationCallBack
    , myUIAuto);
  6. Add the following method to the Form1 class.

    // Notify the Automation object and ConversationWindow
    // that the conversation started.
    private void BeginConversationCallBack(IAsyncResult ar)
      if (ar.IsCompleted == true)
        Automation _automation = ar.AsyncState as Automation;
        cWindow = _automation.EndStartConversation(ar);
        IAsyncResult OpenExtensibilityResult = cWindow.BeginOpenExtensibility("{40499119-4B60-45a6-9A7A-DC7A384D5670}",null,null);
  7. Build and run the application.

  8. In the conversation window on the sending and receiving clients, the Lync Conversation Window Extension appears with the context application.

See Also

Other Resources

Lync Extensibility API Conversation Walkthroughs (Lync 2010 SDK)