Create a custom Persistent Chat client

Lync 2013

Beyond the basics topic

Learn about the components of a typical custom Lync 2013 Persistent Chat window that is built by using Microsoft Lync 2013 SDK.

Last modified: January 03, 2013

Applies to: Lync 2013 | Lync Server 2013

A typical scenario where you use the classes in the Microsoft.Lync.Model.Room namespace is to create a chat room client in your own application. The design of your chat room UI is completely up to you. However, it should contain several basic UI features. These features include the following:

  • A selectable chat room list whose source is the Lync contact list.

  • A set of text controls that display the chat room title and room description.

  • A list of previously posted messages that can be refreshed according to a user’s needs.

  • A set of controls that let a user select the range of messages that are used to refresh the message list.

  • A registered event listener that refreshes the message display with each new message posted to the room.

  • An entry control that accepts a string to be posted to the chat room as a message.

Optional chat room features can include a chat room roster that shows a list of other participating users and a rich-text entry control that lets a user format the message text before sending it.

Figure 1 shows the Persistent Chat window that is discussed in this topic. The elements that you must have to create a Persistent Chat window appear in this window. The elements in the chat room window include the following:

  1. The Persistent Chat rooms that a user is following in the contact list.

    All displayed messages have been posted to the selected chat room and the selected chat room is the destination of any message posted by the user.

  2. Participants in the chat room that is selected in the chat room list.

  3. The description of the selected chat room.

  4. The number of unread messages posted to the selected chat room.

  5. The messages that have been posted to the chat room by any member of the room.

    Important note Important

    This example uses a ListBox control, which ignores RTF formatting codes in messages posted to a room. For more information, see ListBox Class.

  6. A text field that accepts a message ID that is used to get a set of messages previously posted to the selected room.

  7. A text field that accepts an integer value for the maximum number of messages to retrieve with each request for messages.

  8. A button to start a message get request that uses the values from the two previous text fields.

  9. An RTF text box that accepts a string that will be posted to the room as a new message.

  10. A button that posts a new message to the room.

Figure 1. Simple Persistent Chat window

Simple Group Chat Client

This topic does not explore the code details for the UI controls that appear in figure 1. The following topics show how to write code for the controls that are used in figure 1.

After you create the UI control elements that appear in figure 1, the topics in the following table show how to add the content for the controls with values obtained from a Microsoft.Lync.Model.Room.Room instance, post messages to a chat room, and respond to events from the chat room.


Persistent Chat feature

How to: Find a chat room

Describes how to fill the followed room list that uses chat rooms from a user’s contact list. This topic also shows how to get chat rooms that are not in the user’s contact list.

How to: View chat room participants

Describes how to display a roster of chat room members that are in the chat room.

How to: Send a message to a chat room

Describes how to post a message to a chat room.

How to: Read messages sent to a chat room

Describes how to display the messages as they are posted to a chat room.

How to: Filter an outgoing message from a local user to a chat room

Describes how to catch messages before a local user can post a message and then pass the message on, reformat the message text, or cancel the message.