Export (0) Print
Expand All
2 out of 2 rated this helpful - Rate this topic

Creating and Using a Lync Silverlight Control: How to (Part 1 of 2)

Summary:   This article describes how to use Microsoft Silverlight to create a custom Microsoft Lync control, how to distribute the Silverlight custom control, and how to deploy a Silverlight application that uses the control.

  • The Microsoft Lync 2010 SDK is required on the class library computer.

  • On each computer that is running the deployed Microsoft Silverlight application:

    • Add the Web server that is hosting the Silverlight application to the trusted sites list.

    • Sign in to the Microsoft Lync 2010 client.

The Lync code in this article is intended only as a placeholder for the code that you use to implement your own scenario for a Microsoft Lync Silverlight control. The example scenario in this article creates a control that makes it easy to invite group members to a weekly conference. Scenario tasks:

  1. Create a new custom group named Sample.

  2. After the user adds contacts to the Sample group, display the contact URIs of group members in the list box.

  3. After the user selects one or more contacts in the list box, send an instant message inviting those contacts to a conference.

Creating a custom Silverlight control is easy, you merely create and build a Silverlight class library. The Silverlight control itself can be distributed and used in new Silverlight applications; and the Silverlight applications that contain the control can be deployed to a Web server. This article describes how to create a control, how to use a custom control in a new application, and how to deploy an application that contains the control to a Web server.

The distribution and deployment process described in this article is as simple as it can be. Any organization running Microsoft Lync Server 2010 undoubtedly has its own safe and secure procedure that should replace the one described here.

To create a custom Lync Silverlight control, simply add your code to a Silverlight Class Library application, build the application, and distribute the component.

Figure 1. The Silverlight page Design pane

Design pane

To create the Lync Silverlight control

  1. In Microsoft Visual Studio 10 development system, use the Silverlight Class Library template to create a new application.

  2. Add a new Silverlight page to the application.

  3. From the code listing in Creating and Using a Lync Silverlight Control: Code Listing (Part 2 of 2), copy the XAML code and use it to overwrite the default XAML in Page1.xaml.

  4. From the code listing in part 2, copy the C# code and use it to overwrite the default C# in Page1.xaml.cs.

  5. Add a reference to the Microsoft.Lync.Model namespace.

  6. Build the application.

  7. Note the path of the project's dll file. By default it is named SilverlightClassLibrary1.dll and is located in the SilverlightClassLibrary1 bin/Debug folder.

To use the custom Lync Silverlight control in an application, simply add the control to the Toolbox and drag it onto the Design pane.

Figure 2. The Choose Toolbox Items dialog box

Toolbox items dialog

To add the control to a Silverlight application

  1. In Visual Studio 10, use the Silverlight Application template to create a new application.

  2. Copy the following files from the class library project to the application project folder.

    • Microsoft.Lync.Model.dll

    • Microsoft.Lync.Utilities.dll

    • SilverlightClassLibrary1.dll

    • System.Windows.Controls.Navigation.dll

  3. Right-click the Toolbox and select Choose Items.

  4. In the Choose Toolbox Items dialog box, click Browse.

  5. Browse to the class library .dll file, identified in step 2 in this procedure.

  6. Select the file and then click Open.

  7. Build the application.

  8. In the Toolbox, locate the new Silverlight control.

  9. Drag the new control to the Design pane.

    Caution note Caution

    The page constructor runs when the control is dropped on the Design pane at design time, even though the project does not appear to be running. For information about debugging, see Debugging Design-Time Controls.

  10. Build the Silverlight application.

  11. Note the path of the application's .html test file and the .xap file. By default the files are located in the Silverlight1 project bin/Debug folder.

Run the application and evaluate the Lync functionality.

Figure 3. Adding contacts to the Sample group

Adding contacts

To test the Lync Silverlight control

  1. On the application computer, ensure that you are signed in to the Lync client.

  2. Run the Silverlight application.

  3. Click Create Group.

  4. To add contacts to the group, in the Lync client use Search to find a contact. Right-click the contact, click Copy Contact To and then select Sample.

  5. Once several contacts are added to the group, click List Contacts.

  6. In the list box, select one or more contacts.

  7. Click Send Invites.

To deploy a Lync Silverlight application, copy the application’s .xap and .html files to a public folder on a Web server. The Web server must be added as a trusted site on each client that is running the application.

John Austin is a programmer/writer on the Microsoft Lync feature team. John has written several software development kits including Microsoft Office Communicator Web Access XML SDK, Microsoft Office Communicator 2007 Automation SDK, Microsoft Unified Communications Client Platform 1.0 SDK, and Microsoft Lync 2010 SDK.

John Clarkson is also a programmer/writer on the Microsoft Lync feature team.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.