Adding Lync 2010 Features to Your Application (Part 1 of 2)

Summary:   Is Microsoft Lync 2010 the greatest thing since the first BASIC interpreter? Organize your contacts, call your contacts, IM them, see at a glance whether they are available, share documents, and share desktops. It’s a mighty little tool box of corporate communications gadgets! Microsoft Lync 2010 SDK includes Lync 2010 API and a set of Microsoft Silverlight and Microsoft Windows Presentation Foundation (WPF) controls that you can use to add Lync functionality, in whole or in part, to your business application. This article discusses how to add Lync features to an existing application.

Applies to:    Microsoft Lync 2010 | Microsoft Lync Server 2010 | Published:   November 2010 | Provided by:   John Clarkson, Microsoft | About the Author


  • How to Use Lync 2010 SDK

  • Adding Presence to a Silverlight Application

  • Conclusion

  • Additional Resources

How to Use Lync 2010 SDK

Let’s say that you work for an oil and gas production and exploration company which uses a proprietary application to visualize and analyze geological data, looking for new drilling sites. This application is used by your engineers around the world, in North America, Asia, and Europe. The engineers could use Lync side-by-side with the application, but it would be so much better if Lync were embedded in the application itself. Use Lync 2010 SDK to do this.

You can add Lync to this proprietary application. This allows engineers in different sites to simultaneously share and view data, while discussing it through IM or voice. Just for example. And you do not have to add all of Lync to the application, merely add the bits and pieces that are valuable to you. You can drag-and-drop XAML controls; or for more advanced scenarios, use a .NET Framework language to incorporate Lync 2010 API features into the application.

The two most important requirements:

  • Lync is running on the client computer.

  • You have access to Microsoft Lync Server 2010.

Lync 2010 SDK includes approximately twenty controls. Each Lync control provides a specific feature like search, presence, IM calls, and audio calls. The appearance of each control replicates the Lync 2010 UI for that feature. Use a single control or multiple controls. The programming style is primarily XAML text. But you can also use C# in the code-behind file to access Lync 2010 API and the .NET Framework. The following examples show the StartAudioCallButton and ContactCard controls.

StartAudio control contact card

You can see the full list of controls, alongside sample code and walkthroughs, in the Lync 2010 SDK help. Oh, and if the appearance of the controls does not fit your corporate identity – maybe there is a specific color palette you prefer – the controls can be re-skinned by customizing templates or styles, also described in the SDK help.

One of the key benefits of Lync is that you can easily see the presence or availability of your colleagues. Presence refers to whether someone is in or out of office, available, or offline. For example, you can see in the previous illustration that the contact card tells us Evan Basalik is Away with the presence indicator displaying yellow, and Evan has been gone for 2 hours. The next few sections show you how easy it is to add presence to a Silverlight or WPF application.

Adding Presence to a Silverlight Application

The steps here describe using Microsoft Visual Studio 2010 development system and Lync 2010 SDK to add presence to a Silverlight application. The steps for a WPF application are similar.

Create a Silverlight Application

  1. In Visual Studio, create a new project by using the Silverlight Application template.

  2. Clear the Host the Silverlight check box.

Add Project References

  • Add references to following libraries.

    • Microsoft.Lync.Controls.dll

    • Microsoft.Lync.Controls.Framework.dll

    • Microsoft.Lync.Model.dll

    • Microsoft.Lync.Utilities.dll

Add XAML Text

  1. Add the following XAML text to declare the namespace.

    • xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"
  2. Add the following XAML text to the Grid control.

    • <controls:PresenceIndicator Source="" />
  3. Edit the Source property to provide a value that is valid in your domain.

Run the Application

  1. Press F5. The control appears in the center of the page. If “available” is the presence setting for the contact that you entered in the Source property, the presence indicator is green. Different presence settings, different colors.

  2. Roll your pointer across the control and see the contact card matching the SIP URI in the Source property.

Add to the Application

  1. Close the application and try entering values for the Height and Width property of the PresenceIndicator control to make it bigger. Try 50 pixels to start.

  2. Also try to add XAML for other controls, like a ScheduleMeetingButton control.

  3. Drag and drop a StartAudioCallButton control to the Design pane, and set the Source property for the control to tel:12075550100.


Use an assortment of XAML controls, or a .NET Framework language to add Lync UI and features to .NET and web applications.

Additional Resources

For more information, see the following resources:

About the Author

John Clarkson is a technical writer for Microsoft Unified Communications Group.