我想知道获取在 Lync 中右键单击联系人并选择呼叫然后单击号码时单击的电话号码的正确方法。
预期是一个带有被点击号码的电话字符串。
有人可以概述一下我们在这种情况下将使用的事件以及检索号码的代码吗?
目前,我正在使用该ConversationManager.ConversationAdded
事件并从联系人端点 URI 中检索号码,但这仅在一半时间内有效,因为有时即使我点击了实际的电话号码,默认端点也会以 SIP 字符串的形式出现。
这里是代码。
Private Sub ConversationManager_ConversationAdded(ByVal sender As Object, ByVal e As Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs) Handles m_lyncConversationManager.ConversationAdded
Dim ConvParticipants As IList(Of Participant) = e.Conversation.Participants
Dim ContactURI() As String = ConvParticipants.Item(1).Contact.Uri.ToString().Split(":")
If e.Conversation.Modalities(ModalityTypes.AudioVideo).State = ModalityState.Connecting Then
Dim outboundContact As Contact = ConvParticipants.Item(1).Contact
Dim _ContactSettings As IDictionary(Of ContactSetting, Object) = outboundContact.Settings
Dim outObject As Object = Nothing
Dim PhoneNumber() As String
If _ContactSettings.TryGetValue(ContactSetting.DefaultContactEndpoint, outObject) Then
PhoneNumber = DirectCast(outObject, ContactEndpoint).Uri.Split(":")