Use Microsoft Lync Controls to add presence and availability information on colleagues, customers, and vendors to your new or existing applications. This topic identifies the basic strategies for adding presence to Microsoft Windows Presentation Foundation (WPF), and Microsoft Silverlight applications.

Lync Control applications require the user to sign in to Microsoft Lync 2010. Each Lync Controls application connects to Microsoft Lync Server 2010 using a single out-of-process connection to Lync 2010. The application is either a WPF or Silverlight application containing Lync Controls.

Authoring Notes

For Windows Forms and WPF applications it is common to use one thread for UI, and a separate thread for tasks such as database access or asynchronous network calls. However, in Silverlight Lync Controls applications, keep all application logic in the UI thread.

For event handling in Silverlight Lync Controls applications, you must marshal relevant event data to your UI thread using something like Dispatcher.Invoke . To do otherwise raises a cross-thread exception.

Adding Presence to an Existing .NET Application

To add Lync Controls to an existing .NET application, add a WPF User Control to the .NET application project. Add your Lync Controls to the User Control, and then move the User Control to the .NET application using a drag-and-drop operation. For a walkthrough of the required steps, see Walkthrough: Add Presence to an Existing .NET Application .

Adding Presence to an Existing WPF Application

To add Lync Controls to an existing WPF application, add project references for the Lync Control DLLs, and then add XAML code to create the Lync Controls.

To add Lync Controls to an existing WPF application

  1. Sign in to Microsoft Lync 2010.

  2. In Microsoft Visual Studio, add project references to the WPF versions of the following libraries.

    • Microsoft.Lync.Controls.dll

    • Microsoft.Lync.Controls.Framework.dll

    • Microsoft.Lync.Model.dll

    • Microsoft.Lync.Utilities.dll

    • Microsoft.Office.Uc.dll

  3. On the appropriate XAML page, add the following XAML text to declare the Lync Controls namespace.

      Copy imageCopy Code
    xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"
    
  4. Author the appropriate XAML code to add the Lync Controls. For example, the following XAML will add a MyStatusArea control. For more information, see Walkthrough: Presence Hello World .

      Copy imageCopy Code
    <StackPanel>
      <controls:MyStatusArea PhotoDisplayMode="Small"/>
    </StackPanel>
    
  5. Build and run the application.

Adding Presence to an Existing Silverlight Application

To add Lync Controls to an existing Silverlight application, add project references for the Lync Control DLLs, and then add XAML code to create the Lync Controls.

To add Lync Controls to an existing Silverlight application

  1. Sign in to Lync 2010.

  2. Add project references to the Silverlight versions of the following libraries.

    • Microsoft.Lync.Controls.dll

    • Microsoft.Lync.Controls.Framework.dll

    • Microsoft.Lync.Model.dll

    • Microsoft.Lync.Utilities.dll

  3. On the appropriate XAML page, add the following XAML text to declare the Lync 2010 namespace.

      Copy imageCopy Code
    xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"
    
  4. Author the appropriate XAML code to add the Lync Controls. For example, the following XAML will add a MyStatusArea control. For more information, see Lync Controls Walkthroughs .

      Copy imageCopy Code
    <StackPanel>
      <controls:MyStatusArea PhotoDisplayMode="Small"/>
    </StackPanel>
    
  5. Build and run the application.

See Also

Other Resources