Lync - inconsistent behavior with ContactEndpoints

隐身守侯 提交于 2019-12-10 13:55:57

问题


I'm working on custom UI for company's directory based on Lync. Using Lync 2013 I execute this search:

Container.Instance.Lync.ContactManager.BeginSearch(SearchQuery,
            SearchProviders.GlobalAddressList,
            SearchFields.AllFields,
            SearchOptions.IncludeContactsWithoutSipOrTelUri,
            500,
            ContactsAndGroupsCallback, SearchQuery);

For each of matching contacts I try to access their endpoints to display phone number:

var cit = ContactInformationType.ContactEndpoints;
var endpoints = contact.GetContactInformation(cit) as List<object>;

Problem

If found contact is in the contact list of account I'm using to connect Lync, then I get access to full details (5 endpoints). However if he is not in contact list, I get access to only 1 endpoint.

Any ideas why is it happening like that? Is there a global privacy setting I need to turn off or something?

How can I get access to all endpoints at all times?

Thank you.

PS: I tried to load each contact in the result set individually and still get the same behavior.


回答1:


I encountered a similar problem when trying to write a program to obtain the status of all users on Lync SDK 2010. Chose all users and read it's status (online / offline etc.). But it's working out well with only those contacts that were in the list of client contacts. I do not know why, but the solutions are not found.A little later I use UCMA 4 (with Application endpoint), though the list received from AD and only able to get the current status.

Maybe it makes sense to use the search by AD? Find phone number by user sip? If so, try to use this filter for DirectorySearcher:

searcher.Filter = "(&(objectClass=user)(msRTCSIP-PrimaryUserAddress=*))"; //put sip instead of *

P.S. what sdk are you using?




回答2:


Answer from Microsoft Support:

The behavior you are seeing is due to presence subscription optimization to the Lync client so that the subscription is delayed until the necessary contact information is required by the Lync client. Photo is an example for this optimization. Another example is ContactEndpoints. Please take a look at Contact presence subscription changes section of the Migration doc for Lync 2013 page in MSDN docs. Specifically you must create and maintain your own ContactSubscription for the contacts that you need all the ContactEndpoints.




回答3:


I have been facing the same issue. You can try loading the person's ContactCard before calling the GetContactInformation function explicitly

Microsoft.Lync.Controls.ContactCard objContactCard = new Microsoft.Lync.Controls.ContactCard(); objContactCard.Source=objContact.GetContactInformation(ContactInformationType.EmailAddresses);

           ContactSubscription _contactSubscription = lyncObj.ContactManager.CreateSubscription();

                _contactSubscription.AddContact(foundContact);

                _contactSubscription.Subscribe(ContactSubscriptionRefreshRate.High, _ContactInformationList);

However, you still might get some delay in getting the information (phone numbers). You can choose to use Thread.Sleep or might just want to retry. Hope this helps.




回答4:


Problematic is relying on contact information even for the lync client user. In our solution we are doing something like this:

Contact user = LyncClient.GetClient().Self.Contact;
string email = user.GetContactInformation(ContactInformationType.PrimaryEmailAddress) as string;

I would expect that the current lync user contact always is filled properly. And if it wasn't, I'd expect the code to throw an exception or at least return null or an empty string. Instead it sometimes returns the sip-uri of the contact without the leading "sip:" prefix. Oddly enough this is not always reproducable: Most of the time the code above returns the primary email address (according to active directory) correctly, sometimes it behaves as mentioned above.



来源:https://stackoverflow.com/questions/18516690/lync-inconsistent-behavior-with-contactendpoints

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!