Expanded code samples
Learn about the sample applications that are installed on your computer when you install Microsoft Lync 2013 SDK.
Applies to: Lync 2013 | Lync Server 2013
Code samples overview
The sample collection includes quick-start samples that let you get started quickly with Lync development by demonstrating one Microsoft Lync 2013 API feature at a time. There is also a set of end-to-end samples that show how to put all the API features together to create a complete unified communication solution. You can download these samples from the MSDN samples code gallery. Links to individual code gallery samples are found in the How to topics where a corresponding sample is available to download.
Quick-start samples
The quick-start samples are grouped by API feature area. Many of these samples demonstrate Lync API features that have been in the API since the initial release of Lync, such as the presence-related samples that show how to use Lync Controls to display and update presence. The new Lync SDK features are demonstrated by the Persistent Chat, resource sharing, and content sharing samples.
Presence samples
The quick-start samples in the following table show how to publish and get presence for a contact by using presence controls or objects in the Lync 2013 API object model.
Application |
Description |
---|---|
MyNotebox |
Populates a page with a MyNoteBox control and displays the signed-in user’s display name and personal note in a text entry control.
|
MyPresenceChooser |
Populates a window with a MyPresenceChooser control that lets a user choose a presence activity. The resulting availability state is displayed in a text block on the page.
|
MyStatusArea |
Populates a window with a MyStatusArea control that lets a user choose a presence activity and enter a personal note. Three text blocks on the page are bound to MyStatusArea control properties for the user display name, availability state, and personal note. The text value of these text blocks are automatically updated when the corresponding properties of the MyStatusControl change.
|
PresenceIndicator |
Populates a list on a page with three PresenceIndicator instances. The user can hover a mouse pointer over any of the presence indicators to display a contact card for a user. The Source property for each control instance is set by the sample application.
|
Presence publication |
Retrieve and publish information of the Self contact (the currently signed-in user) by using classes, enumerations, events, and methods of the Lync 2013 API. It also shows how to sign in to Lync using the credentials of the active user. The sample uses the following classes and methods:
Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Contact samples
The contact samples in the following table show how to interact with Lync contacts by using the objects of the Lync 2013 API and controls from the Microsoft.Lync.Controls namespace.
Application |
Description |
---|---|
ContactCard control list |
Loads three ContactCard controls into a list on a page in a Silverlight or WPF application.
|
ContactList control |
Populates a page with the ContactList control and then lists the SIP URI values for the contacts in the list.
|
CustomContactList control |
Populates a page with a CustomContactList control and several child CustomContactListItem objects. The child objects are created and added at runtime by using C# code in a code-behind source file.
|
ContactSearch control |
Populates a page with a ContactSearch control and searches for used-by user name or skill.
|
Contact search with input box and search results |
Populates a page with a ContactSearchInputBox control and a ContactSearchResultList control. The ContactSearchInputBox is bound to the ContactSearchResultList so that the resulting list displays search results based on what the user types in the search input box.
|
Display frequent and favorite contacts |
Populates a page with a list of favorite contacts and a list of frequent contacts. The sample uses the following classes and methods:
WPF sample location: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Add and remove a custom group |
Lists the groups in your contact list and lets you add or remove a group. The sample uses the Groups property, the BeginAddGroup method, and the BeginRemoveGroup method. Path: %PROGRAMFILES(X86)%\Microsoft Lync\SDK\Samples |
MoveContactBetweenGroups |
Lists all custom groups in a user’s contact list and lets a user move a contact from one custom group to another. The sample uses the following classes and methods:
Path: %PROGRAMFILES(X86)%\Microsoft Lync\SDK\Samples |
Add and remove a contact from a group |
Adds and removes contacts from the Other Contacts group. The sample uses the following classes and methods:
Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Conversation samples
The conversation samples in the following table show how to interact with Lync conversations by using the objects of the Lync 2013 API and Lync Controls from the Microsoft.Lync.Controls namespace.
Application |
Description |
---|---|
ButtonsDesktop |
Shows how to display Lync conversation-starting controls in a list. The Source property for each control is set to the URI of a user. The controls used in the sample include: StartInstantMessagingButton, StartAudioCallButton, StartVideoCallButton, ShareDesktopButton, SendFileButton, SendEmailButton, and ScheduleMeetingButton.
|
AcceptConversation |
Displays a window that registers for the ConversationAdded event and then notifies the user when a conversation invitation is received. If the user chooses to ignore the invitation, the window ends the new conversation. The sample uses the following classes and methods:
WPF sample location: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
StartConversation |
Start an IM conversation using the ConversationManager class. Messages are sent using plain text.
|
StartFormattedConversation |
Start an IM conversation using the ConversationManager class. Messages are sent in the MIME type selected by the user.
|
DockingConversationWindowSample |
Start and dock an IM conversation using the StartInstantMessagingButton control.
|
MeetNow |
Start a meet-now conference using automation
|
JoinMeetingFromLobby |
Joins a running meeting and notifies the users if they are in the meeting lobby.
|
Automation conversation |
This sample uses the Automation class in the Lync 2013 API to start a new conversation with one or more Lync contacts. Features include the following:
Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Conversation Window Docker |
This application demonstrates the ability to dock a conversation window within another WPF application. The sample:
Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Audio/Video Conversation |
This sample uses the Microsoft.Lync.Model.Conversation and Microsoft.Lync.Model.Conversation.AudioVideo namespaces from the Microsoft Lync 2013 API to implement a conversation window. The sample:
Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Persistent Chat samples
The following sample applications demonstrate how to add chat room features to a Microsoft Lync 2013 SDK-enabled application.
Application |
Description |
---|---|
GetMessages |
The GetMessages sample application shows how to get messages that have been posted to a Persistent Chat room and then display any new message that are posted to the chat room. In addition, the sample shows how to get the chat rooms that are in a user’s contact list and keep that room collection synchronized with the contact list. Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
FollowedRoomList |
The FollowedRoomList sample application shows how to get the Persistent Chat rooms that are in a user’s contact list and then keep that room collection synchronized with the contact list. For information about how to find Persistent Chat rooms that are not in a user’s contact list, see "RoomQuery" application later in this topic. Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
RoomQuery |
The RoomQuery sample application shows how to get a collection of Persistent Chat rooms that are not in a user’s contact list. For information about finding Persistent Chat rooms that are in a user’s contact list, see "FollowedRoomList" application earlier in this topic. Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
PostMessage |
The PostMessage sample application shows how to post a plain-text message to a Persistent Chat room in a user’s contact list and verify that the message posted successfully. In addition, the sample shows how to get a chat room from the contact list. Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
GetParticipants |
The GetParticipants sample application shows how to get a list of Persistent Chat room participants. In addition, the sample shows how to get a chat room from the contact list. Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
FilterMessageAddIn |
The FilterMessageAddIn sample application shows how to get a hosting group for a Persistent Chat room, catch outgoing messages before they are posted to the hosting chat room, run filtering and formatting logic on the messages, and then send the resulting message to the hosting chat room. Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Content sharing samples
The following sample application demonstrates how to share whiteboards, PowerPoint slide decks, and native file attachments in a conversation.
Application |
Description |
---|---|
ContentModalitySample |
Shows how to create a conversation and then share a whiteboard and a PowerPoint slide deck. If a PowerPoint slide deck is shared, the sample lets a user scroll forward and backward in the slide deck. The sample uses the following classes and methods:
WPF sample location: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples |
Reference samples
The following samples provide complete application examples using the Lync 2013 API. These examples illustrate the use of Lync 2013 API in real-world scenarios.
Conversation translator
This sample uses the Microsoft.Lync.Model.Conversation namespace from the Lync Model API to intercept instant messages and provide translation using Bing Web Services.
Features include the following:
The sample provides an example architecture for registering for and handling asynchronous Lync 2013 API events in Silverlight.
Register for two Conversation related events: ParticipantAdded and InstantMessageReceived.
Use the BeginSendMessage method and callback.
Uses the Bing Translator Web Service.
Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples
\ConversationTranslator\ConversationTranslator.csproj
Proposal tracker
The ProposalTracker application demonstrates the use of Microsoft Lync Controls in a Silverlight application. The application is a demonstration, representing a tool used by a fictitious company called Fabrikam, Inc. It tracks a list of proposals and sales people in the company.
Features include the following:
Demonstrates how to use the following Lync Controls in a Silverlight application:
MyStatusArea control
PresenceIndicator control
ContactCard control
ContactList control
CustomContactList control
ContactSearchInputBox control
ContactSearchResultList control
Demonstrates how to use ContextualConversation between two conversation windows with the companion application MiniProposalTracker, which runs in a Lync Conversation Window Extension.
Path: %PROGRAMFILES(X86)%\Microsoft Office 2013\LyncSDK\Samples
\ProposalTracker\ProposalTracker.sln