0
我目前正在尝试在我的应用程序中显示Lync用户的联系人图片。运行良好,但前提是在Lync客户端中查看用户。似乎需要某种缓存。如果以前没有查看它或者让用户在联系人列表中直接联系,它将不会返回任何内容。任何想法如何通过代码进行查找?那是我在做什么现在:Lync 2013 SDK GetContactInformation照片
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