We are using the Lync SDK to fetch contact information and phone numbers to display in our application. Lync search control is used and on right click on a contact, we try to fetch the phone numbers of the contact.
This has intermittent issue of not returning the complete information in the contact card in Lync search control. At times it works good but other times, it fails to return complete phone number list.
List<object> endPoints = new List<object>();
List<ContactInformationType> _ContactInformationList = new List<ContactInformationType>();
_ContactInformationList.Add(ContactInformationType.EmailAddresses);
_ContactInformationList.Add(ContactInformationType.ContactEndpoints);
try
{
if (!string.IsNullOrWhiteSpace(sipuri))
{
Contact _contact = lyncObj.ContactManager.GetContactByUri(sipuri);
Microsoft.Lync.Controls.ContactCard _contactCard = new Microsoft.Lync.Controls.ContactCard();
_contactCard.Source = contact.GetContactInformation(ContactInformationType.EmailAddresses);
ContactSubscription _contactSubscription = lyncObj.ContactManager.CreateSubscription();
_contactSubscription.AddContact(_contact);
_contactSubscription.Subscribe(ContactSubscriptionRefreshRate.High, _ContactInformationList);
// add sleep to subscribe
System.Threading.Thread.Sleep(500);
var telephoneNumbersList = (List<object>)_contact.GetContactInformation(ContactInformationType.ContactEndpoints);
foreach (object endPoint in telephoneNumbersList)
{
Logger.LogInfo(((ContactEndpoint)endPoint).DisplayName + " " + ((ContactEndpoint)endPoint).Type.ToString());
}
endPoints = telephoneNumbersList.Where<object>(N => ((ContactEndpoint)N).Type == ContactEndpointType.HomePhone || ((ContactEndpoint)N).Type == ContactEndpointType.MobilePhone || ((ContactEndpoint)N).Type == ContactEndpointType.OtherPhone || ((ContactEndpoint)N).Type == ContactEndpointType.WorkPhone).ToList<object>();
}
}
Several times, the complete contact information is not returned. Only one out of two phone numbers are seen in the contact information. While some time all phone numbers are returned.
If I try to search the same contact over Microsoft Lync search I can see all phone numbers in contact card.
Could you please suggest what could be the root cause and probable solution?