How to: Browse available Persistent Chat rooms
Learn how to browse the available Persistent Chat rooms in a Microsoft Lync Server 2013 Persistent Chat deployment.
Applies to: Lync 2013 | Lync Server 2013
When a PersistentChatEndpoint instance is connected to a Lync Server 2013 Persistent Chat, its state becomes Established and the endpoint-based Persistent Chat services that are encapsulated by PersistentChatServices becomes operational immediately. Such services include browsing available chat rooms by calling BeginBrowseChatRoomsByCriteria(String, Boolean, Boolean, Boolean, AsyncCallback, Object), BeginBrowseChatRoomsByInvitations(Int32, AsyncCallback, Object), BeginBrowseChatRoomsByJoinedUser(Uri, AsyncCallback, Object), BeginBrowseChatRoomsIManage(AsyncCallback, Object, UInt32), or BeginBrowseMyChatRooms(AsyncCallback, Object, UInt32) method on the PersistentChatServices type. These methods are asynchronous and the operations must be completed by calling the corresponding EndBrowseXXX method. The following example shows how to invoke these methods to browse available persistent chat rooms on a Persistent Chat server.
public void BrowseChatRooms(PersistentChatEndpoint chatEndpoint, string criteria, ref int lastInviteId, string userSipUri)
{
PersistentChatServices chatServices = chatEndpoint.PersistentChatServices;
var rooms = chatServices.EndBrowseChatRoomsByCriteria(
chatServices.BeginBrowseChatRoomsByCriteria(criteria, true, false, false, null, null)
);
ShowBrowseChatRoomsResults("Criteria", rooms);
rooms = chatServices.EndBrowseChatRoomsByInvitations(
chatServices.BeginBrowseChatRoomsByInvitations(lastInviteId, null, null), out lastInviteId
);
ShowBrowseChatRoomsResults("Invitations", rooms);
rooms = chatServices.EndBrowseChatRoomsByJoinedUser(
chatServices.BeginBrowseChatRoomsByJoinedUser(new Uri(userSipUri), null, null)
);
ShowBrowseChatRoomsResults("JoinedUser", rooms);
rooms = chatServices.EndBrowseMyChatRooms(
chatServices.BeginBrowseMyChatRooms(null, null, 10)
);
ShowBrowseChatRoomsResults("MyChatRooms", rooms);
rooms = chatServices.EndBrowseChatRoomsIManage(
chatServices.BeginBrowseChatRoomsIManage(null, null, 10)
);
ShowBrowseChatRoomsResults("IManage", rooms);
}
void ShowBrowseChatRoomsResults(string browseMode, ReadOnlyCollection<ChatRoomSnapshot> res)
{
Console.WriteLine("Browse Chat Rooms by {0}", browseMode);
foreach (var r in res)
{
Console.WriteLine("Name={0}\tDescription={1}\tNumber of participants={2}\tChatRoomUri={3}",
r.Name, r.Description, r.NumberOfParticipants, r.ChatRoomUri.ToString());
}
}
The results returned from browsing chat rooms methods are a collection of ChatRoomSnapshot objects. The ChatRoomUri property on this kind of object can be used to join a chat room. For more information, see How to: Join and leave a Persistent Chat room session.
See also
Concepts
Learn the basics of Lync Server 2013 Persistent Chat SDK
How to use Persistent Chat API (Lync Server 2013 Persistent Chat SDK)
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for