【问题标题】:Lync 2013 SDK GetContactInformation PhotoLync 2013 SDK GetContactInformation 照片
【发布时间】: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


    【解决方案1】:

    您正在寻找的是ContactSubscription。对于您希望查看“信息”(例如照片)的每个联系人,您添加到联系人订阅中,只要您希望拥有的信息可用或更改,您就会被回叫。 Microsoft 在使用联系人订阅时提供howto

    所以没有办法“现在”获得图像。照片可能需要一段时间才能显示出来。因此,最好在收到回调时显示您拥有的内容并进行更新。

    【讨论】:

      猜你喜欢
      • 2013-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-27
      • 1970-01-01
      • 1970-01-01
      • 2013-09-06
      相关资源
      最近更新 更多