Search code examples
c#lync

Lync - inconsistent behavior with ContactEndpoints


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.


Solution

  • 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.