我们正在使用 Lync SDK 获取联系信息和电话号码以显示在我们的应用程序中。使用 Lync 搜索控件,右键单击联系人,我们尝试获取联系人的电话号码。
这会出现间歇性问题,即在 Lync 搜索控件中的联系人卡片中不返回完整信息。有时它运行良好,但有时它无法返回完整的电话号码列表。
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>();
}
}
有几次,没有返回完整的联系信息。联系信息中只显示了二分之一的电话号码。一段时间后,所有电话号码都会返回。
如果我尝试通过 Microsoft Lync 搜索搜索同一个联系人,我可以在联系人卡片中看到所有电话号码。
您能否提出可能的根本原因和可能的解决方案?