Building custom Unified Communications (UC) applications with the Microsoft Lync 2013 SDK allows you to integrate real-time collaboration features—such as presence, instant messaging, voice, and video—directly into your line-of-business applications.
The Microsoft Lync 2013 API serves as a managed-code platform API targeting .NET Framework 4.0 or later. It requires the Lync 2013/Skype for Business client to be actively running on the host machine to handle the underlying SIP signaling and protocol stacks. Essential Prerequisites
Before you start writing code, your development environment must meet these technical requirements: IDE: Microsoft Visual Studio 2010 or newer. Framework: .NET Framework 4.0+ or Silverlight 5.0 runtime.
Runtime: The Microsoft Lync 2013 desktop client installed and running.
Primary Assemblies: References to Microsoft.Lync.Model.dll and Microsoft.Office.Uc.dll added to your project. Core Architectural Modes
The SDK allows you to build custom client applications using two distinct UI approaches:
Collaboration/Automation Mode: Your app controls Lync via background code but leaves the default Lync visual interface intact. For instance, clicking a button in your custom CRM launches a standard Lync chat window.
UI Suppression Mode: The standard Lync client UI is completely hidden. Your application is solely responsible for rendering the entire user interface, capturing inputs, and drawing contact list components. Fast-Track UI Integration: Lync Controls
For Windows Presentation Foundation (WPF) and Silverlight applications, the SDK includes a collection of drag-and-drop XAML components. These elements pull real-time data directly from the local Lync process without complex backend coding:
MyStatusArea: Displays the current user’s profile picture, availability color, and custom status note.
ContactSearch: Provides a complete search bar that queries the organization’s active directory via Lync.
ContactList: Renders an interactive roster showing real-time presence indicators for targeted colleagues. Advanced Control: The Managed API
For complex scenarios where you need complete, custom handling of real-time communication events, you use the managed API code block. The programmatic hierarchy relies on a strict parent-child architecture:
LyncClient: The entry point representing the local client process. You call LyncClient.GetClient() to hook into the running workspace.
ContactManager: Handles contact lookups, group structures, and tracking changes to presence states.
ConversationManager: Tracks, creates, and terminates collaborative sessions.
Conversation: Represents a specific thread between two or more participants.
Modalities: Separate communication layers within a conversation (e.g., InstantMessageModality, AudioVideoModality, or ApplicationSharingModality). Sample Code: Triggering an Instant Message
The example below demonstrates how to programmatically initialize an out-of-the-way, asynchronous chat window to a specified user using C#: using Use code with caution. Microsoft.Lync.Model Use code with caution.
; using Microsoft.Lync.Model.Conversation; public void StartCustomLyncChat(string contactEmail) { try { // 1. Hook into the local client LyncClient lyncClient = LyncClient.GetClient(); if (lyncClient.State == ClientState.SignedIn) { // 2. Begin a new conversation via the manager Conversation conversation = lyncClient.ConversationManager.AddConversation(); // 3. Find and bind the remote participant Contact targetContact = lyncClient.ContactManager.GetContactByUri(contactEmail); conversation.AddParticipant(targetContact); // 4. Retrieve the Instant Messaging modality layer InstantMessageModality imModality = (InstantMessageModality)conversation.Modalities[ModalityTypes.InstantMessage]; // 5. Send an initial payload string asynchronously IDictionary Use code with caution. Microsoft Lync 2013 SDK (Preview)
Leave a Reply