【问题标题】:UCMA 4.0 How to get user name from PresenceNotificationRecieved HandlerUCMA 4.0 如何从 PresenceNotificationRecieved 处理程序获取用户名
【发布时间】:2016-01-06 00:21:25
【问题描述】:

我正在使用 UCMA 4.0 来获取用户的在线状态。我已经定义了一个这样的事件处理程序

    _remotePresenceView.PresenceNotificationReceived += new EventHandler<
        RemotePresentitiesNotificationEventArgs>(RemotePresence_PresenceNotificationReceived);

其实现如下:

// Event handler to process remote target's presence notifications
private void RemotePresence_PresenceNotificationReceived(object sender,
    RemotePresentitiesNotificationEventArgs e)
{
    Console.WriteLine(String.Format("Presence notifications received for target {0}", <<How do I get the username here>>
        ));
    // Notifications contain all the notifications for one user.
    foreach (RemotePresentityNotification notification in e.Notifications)
    {
        if (notification.AggregatedPresenceState != null)
        {
            Console.WriteLine("Aggregate State = "
                + notification.AggregatedPresenceState.Availability);
        }
    }
    Console.WriteLine("Press ENTER to delete the contact, delete the group, and unsubscribe to the "
        + "presence of the remote user.");

}

我的问题是如何在事件处理程序代码中获取人员通知已更改的用户名?

【问题讨论】:

    标签: c# ucma


    【解决方案1】:

    RemotePresentityNotification 类上有一个ContactCard 属性,它将提供各种详细信息,包括DisplayName,因此在您的情况下,您需要引用notification.ContactCard.DisplayName

    【讨论】:

      【解决方案2】:

      您还可以使用 DirectorySearcher 执行 Active Directory 查找,方法是使用通知的 PresentityUri 属性交叉引用用户的 AD“msRTCSIP-PrimaryUserAddress”属性。

      【讨论】:

        猜你喜欢
        • 2012-07-18
        • 2012-04-30
        • 2017-07-14
        • 1970-01-01
        • 1970-01-01
        • 2015-06-09
        • 1970-01-01
        • 1970-01-01
        • 2011-06-14
        相关资源
        最近更新 更多