Export (0) Print
Expand All

How to: Manage role-based access controls to Persistent Chat rooms

Learn how to manage role-based access controls to Persistent Chat rooms by using the Microsoft Lync Server 2013 Persistent Chat API.

Last modified: August 16, 2013

Applies to: Lync 2013 | Lync Server 2013

Managing user roles in a chat room amounts to maintaining access control to the chat room by specified users. The Lync Server 2013 Persistent Chat API exposes three levels of access control. These are enumerated as Member, Manager, and Presenter. The Creator role is specified in a category and not accessible programmatically.

Making a user a member of a chat room involves adding the user to the chat room in the Member role. Similarly, making a user a manager or presenter involves adding the user in the Manager or Presenter role. These can be accomplished by calling the BeginAddUsersOrGroupsToRole(ChatRoomRole, Uri, ICollection<PersistentChatPrincipalSummary>, AsyncCallback, Object) followed by EndAddUsersOrGroupsToRole(IAsyncResult).

Note Note

To be in a Presenter role, the chat room must be of the auditorium type.

To deny the access to a chat room by a user, simply remove the user from the chat room in his or her given role. This is done by calling the BeginRemoveUsersOrGroupsFromRole(ChatRoomRole, Uri, ICollection<PersistentChatPrincipalSummary>, AsyncCallback, Object) followed by EndRemoveUsersOrGroupsFromRole(IAsyncResult).

The following code example shows how to add a user to a chat room in a given role. The chat room is the first one managed by the currently signed-in user. The to-be-added user is identified by his email address ("johndoe@contoso.com") and retrieved by calling the BeginFindUsersOrGroupsForRole(ChatRoomRole, Uri, String, AsyncCallback, Object) and EndFindUsersOrGroupsForRole(IAsyncResult).

    PersistentChatServices chatServices = persistentChatEndpoint.PersistentChatServices;
    var roomSum = chatServices.EndBrowseChatRoomsIManage(
        chatServices.BeginBrowseChatRoomsIManage(null, null, 100)).FirstOrDefault();
    if (roomSum != null)
       Uri = roomSum.ChatRoomUri;
       var pSums = ChatRoomServices.EndFindUsersOrGroupsForRole(
            null, null));
       if (pSums.Count > 0)
                null, null));

To verify whether the user has been added to a chat room in a given role, the application can call BeginGetMembers(Uri, AsyncCallback, Object), BeginGetManagers(Uri, AsyncCallback, Object), and BeginGetPresenters(Uri, AsyncCallback, Object) followed by EndGetMembers(IAsyncResult), EndGetManagers(IAsyncResult), or EndGetPresenters(IAsyncResult), respectively.

© 2015 Microsoft