【发布时间】:2017-11-21 09:34:03
【问题描述】:
我的应用程序使用 Lync 2013,通过 websocket 与服务器通信,并接收通知。 这些通知采用 Json 格式,因此我将其转换为提取字符串。 该字符串是一个电话号码,我想测试我的一个联系人是否是同一个电话号码以显示他的姓名。
我的 If 总是“假”。 我想使用 > 并提取 DisplayName 的值(电话号码作为字符串),但我不知道该怎么做。 这是我的代码。
foreach (var group in client.ContactManager.Groups)
{
foreach (Contact contact in group)
{
List<object> endpoints = (List<object>)contact.GetContactInformation(ContactInformationType.ContactEndpoints);
List<object> phoneNumbers = endpoints.Cast<object>().Where<object>(N => ((ContactEndpoint)N).Type == ContactEndpointType.HomePhone ||
((ContactEndpoint)N).Type == ContactEndpointType.MobilePhone ||
((ContactEndpoint)N).Type == ContactEndpointType.WorkPhone ||
((ContactEndpoint)N).Type == ContactEndpointType.OtherPhone).ToList();
if (phoneNumbers.ToList().Contains(call.caller))
{
MessageBox.Show(contact.GetContactInformation(ContactInformationType.DisplayName).ToString());
}
}
}
【问题讨论】:
-
我认为如果找到了解决方案。 foreach(var phoneNumber in phoneNumbers) { if (((ContactEndpoint)phoneNumber).DisplayName.ToString() == "我的电话号码收到") { MessageBox.Show(contact.GetContactInformation(ContactInformationType.DisplayName).ToString()); } }
标签: contact phone-number endpoint lync