Subscribe to Lync contact information changes in VB.net

So I recently took on another Lync related challenge in .NET, one that required notification of a Lync contacts information change event.

This was a lot easier then what I thought it would be, thanks in part to the Microsoft.Lync.Model.Contact class. The following code will fire as soon as a contacts information has changed.

Imports Microsoft.Lync.Model.Conversation
Imports Microsoft.Lync.Model

Dim _Client As LyncClient
Dim _contact As Microsoft.Lync.Model.Contact

Private Sub form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        _contact = _Client.GetClient().ContactManager.GetContactByUri("INSERT SIP URI HERE")
        AddHandler _contact.ContactInformationChanged, AddressOf _contact_ContactInformationChanged
End Sub

Private Sub _contact_ContactInformationChanged(sender As Object, e As ContactInformationChangedEventArgs)
'Insert code to execute on detected changes
End Sub

This event will not only fire on an online/offline switch event but also capability of device should a contact switch from one device to another.

Hope you find this of some use.

Mike Hudson

Mike Hudson is a Infrastructure Analyst living and working in Kingston Upon Hull. With extensive experience in Microsoft and Apple technologies, ranging from desktop OS’s to Server OS’s and hardware. By day working as part of an infrastructure team, and by night ridding the world of IT issues through blog posts..

%d bloggers like this: