【发布时间】:2016-12-11 12:09:01
【问题描述】:
我目前正在尝试在我的应用程序中显示 Lync 用户的联系人图片。效果很好,但前提是之前在 Lync 客户端中查找过用户。似乎需要某种缓存。如果没有在之前查找它或将用户作为联系人列表中的直接联系人,它不会返回任何内容。任何想法如何通过代码进行查找?这就是我现在正在做的事情:
Public Function GetLyncPicture(lyncMail As String) As Image
Dim myimage As Image = Nothing
Try
If lyncMail.Trim.Length > 0 Then
client = LyncClient.GetClient()
If client IsNot Nothing Then
Dim cManager As ContactManager = client.ContactManager
If cManager IsNot Nothing Then
Dim contact As Contact = cManager.GetContactByUri(lyncMail)
If contact IsNot Nothing Then
Dim ciList As New List(Of ContactInformationType)()
ciList.Add(ContactInformationType.Photo)
Dim dic As IDictionary(Of ContactInformationType, Object) = Nothing
dic = contact.GetContactInformation(ciList)
If dic IsNot Nothing Then
Dim photoStream As Stream = TryCast(dic(ContactInformationType.Photo), Stream)
If photoStream IsNot Nothing Then
myimage = Image.FromStream(photoStream)
End If
End If
End If
End If
End If
End If
Catch ex As Exception
End Try
GetLyncPicture = myimage
End Function
【问题讨论】:
标签: .net vb.net windows skype lync