首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >检索Lync在线状态

检索Lync在线状态
EN

Stack Overflow用户
提问于 2013-05-27 13:33:49
回答 2查看 6.1K关注 0票数 2

我的要求是,我需要创建一个windows服务来检索Lync的在线状态(可用、忙、请勿打扰...)Active directory中每个用户的。

我用谷歌搜索了一下,发现下面的SDK可以检索Lync的状态。Lync Client 2010 SDK、统一通信托管API、Lync Server 2010 SDK、统一通信客户端API。

请推荐其中最好的SDK来满足我的要求。

提前谢谢。

EN

回答 2

Stack Overflow用户

发布于 2013-05-28 18:23:54

每个SDK都有一个很好的说明,你可以在这里使用它们:http://www.codelync.com/an-overview-of-the-lync-apis/

对于您想要实现的目标,我建议您使用UCMA -统一通信客户端API。它的工作方式是,您为它提供一个您想要监视其状态的用户列表,然后它将在每次他们的状态发生变化时回调事件。一旦你开始订阅,你就会得到一个在线状态事件,所以如果你不想有持续的通知,你可以取消订阅。

订阅大量用户的示例可能是:

代码语言:javascript
复制
  var _remotePresenceView = new RemotePresenceView(_endpoint);
_remotePresenceView.PresenceNotificationReceived += _remotePresenceView_PresenceNotificationReceived;
List<RemotePresentitySubscriptionTarget> subscriptions = new List<RemotePresentitySubscriptionTarget>();

subscriptions.Add(new RemotePresentitySubscriptionTarget("sip:first_user@domain));
subscriptions.Add(new RemotePresentitySubscriptionTarget("sip:second_user@domain));
...
subscriptions.Add(new RemotePresentitySubscriptionTarget("sip:nth_user@domain));

_remotePresenceView.StartSubscribingToPresentities(subscriptions);

在使用远程呈现视图时,有几个提示、技巧和陷阱:查看MSDN here

票数 2
EN

Stack Overflow用户

发布于 2013-12-13 13:51:02

我还试图找到用户的在线状态,并编写了以下代码来实现此要求。

代码语言:javascript
复制
                string _transferUserURI="pass your sipaddress";
                RemotePresenceView _RemotePresence;

                RemotePresenceViewSettings settings = new RemotePresenceViewSettings();
                settings.SubscriptionMode = RemotePresenceViewSubscriptionMode.Default;
                settings.PollingInterval = new TimeSpan(0, 0, 10);
                _RemotePresence = new RemotePresenceView(_appEndpoint, settings);
                _RemotePresence.PresenceNotificationReceived += new EventHandler<RemotePresentitiesNotificationEventArgs>(_RemotePresence_PresenceNotificationReceived);
                //_RemotePresence.SubscriptionStateChanged += new EventHandler<RemoteSubscriptionStateChangedEventArgs>(_RemotePresence_SubscriptionStateChanged);

                RemotePresentitySubscriptionTarget target = new RemotePresentitySubscriptionTarget(_transferUserURI);
                List<RemotePresentitySubscriptionTarget> targets = new List<RemotePresentitySubscriptionTarget>() { target };
                _RemotePresence.StartSubscribingToPresentities(targets);

和_RemotePresence_PresenceNotificationReceived事件

代码语言:javascript
复制
       void _RemotePresence_PresenceNotificationReceived(object sender, RemotePresentitiesNotificationEventArgs e)
    {
        try
        {
            // Extract the RemotePresenceView that received the notification.
            RemotePresenceView view = sender as RemotePresenceView;
            // A RemotePresentityNotification will contain all the
            // categories for one user; Notifications can contain notifications
            // for multiple users.


            foreach (RemotePresentityNotification notification in e.Notifications)
            {
                Console.WriteLine("\nView: " + view.ApplicationContext
                    + " Received a Notification for user "
                    + notification.PresentityUri + ".");

                // If a category on notification is null, the category
                // was not present in the notification. This means there were no
                // changes in that category.
                if (notification.AggregatedPresenceState != null)
                {
                    Console.WriteLine("Aggregate State = " + notification.AggregatedPresenceState.Availability + ".");

                    string Availblity = notification.AggregatedPresenceState.Availability.ToString();
                }

                if (notification.PersonalNote != null)
                {
                    Console.WriteLine("PersonalNote: " + notification.PersonalNote.Message + ".");
                }

                if (notification.ContactCard != null)
                {
                    // A ContactCard contains many properties; only display
                    // some.
                    ContactCard contactCard = notification.ContactCard;
                    Console.WriteLine("ContactCard Company: " + contactCard.Company + ".");
                    Console.WriteLine("ContactCard DisplayName: " + contactCard.DisplayName + ".");
                    Console.WriteLine("ContactCard EmailAddress: " + contactCard.EmailAddress + ".");
                }
            }
        }
        catch
        {

        }
    }

我希望这是你正在寻找的答案,否则如果我错了,请纠正我。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16766842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档