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.
Prerequisites
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
On the sending and receiving clients, add a folder at the path Inetpub/wwwroot.
Create a new .html file that uses the following HTML text.
<html> <head> </head> <body> <p>text in an HTML paragraph element</p> </body> </html>
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
In Microsoft Visual Studio development system, create a GUID for the context application. For more information, see Create GUID (guidgen.exe).
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:
{40499119-4860-45a6-9A7A-DC7A384D5670}
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.
Subkey
Type
Value
DefaultContextPackage
REG_DWORD
0
ExtensibilityWindowSize
REG_DWORD
1
ExternalURL
REG_SZ
https://contoso.com/Test/sample.html
InternalURL
REG_SZ
https://localhost/Test/sample.html
Name
REG_SZ
myContextApplication
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
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.
Add a project reference to Microsoft.Lync.Model. The default location is %ProgramFiles%\Microsoft Lync\SDK\Assemblies\WPF.
In Form1.cs, add the following using statements.
using Microsoft.Lync.Model; using Microsoft.Lync.Model.Extensibility;
Add the following declaration to the Form class.
ConversationWindow cWindow;
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>(); inviteeList.Add("sip:elise@costoso.com"); // 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( AutomationModalities.InstantMessage , inviteeList , myContextObjects , BeginConversationCallBack , myUIAuto);
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); cWindow.EndOpenExtensibility(OpenExtensibilityResult); } }
Build and run the application.
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)