Local Lync client presence on a web page

We've staged up an example off of our website of a simple test for invoking some functionality from a user's local Lync client installed on their machine using JavaScript. This of course requires Internet Explorer 8+ and a Lync client that is running. The JavaScript itself is very straightforward, and I'll include it below with the link.
var Instant = {
    sipUri: "",
    // Load up the NAME.dll functionality
    nameCtl: new ActiveXObject('Name.NameCtrl.1'),
    // Watch status changes
    onStatusChange: function (name, status, id) {
        //alert(name + ", " + status + ", " + id);
    },
    // Shows the Lync widget UI
    showOOUI: function () {
        Instant.nameCtl.ShowOOUI(Instant.sipUri, 0, 15, 15);
    },
    // Hides the Lync widget UI
    hideOOUI: function () {
        Instant.nameCtl.HideOOUI();
    },
    // Opens the full Lync widget menu
    openInfoPane: function () {
        Instant.nameCtl.DoAccelerator();
    },
    // Builds the Lync widget
    // This creates a HTML <span> element with all of the necessary Lync functions built in as
    // onmouseout, onmouseover, onclick selectors.
    buildWidget: function () {
        var lyncWidget = document.createElement("span");
        var container = $("#lync-widget");
        lyncWidget.setAttribute("onmouseover", "Instant.showOOUI()");
        lyncWidget.setAttribute("onmouseout", "Instant.hideOOUI()");
        lyncWidget.setAttribute("onclick", "Instant.openInfoPane()");
        lyncWidget.setAttribute("style", "border-style:dashed;border-width:1px;border-color:#ccc;padding:5px;");
        lyncWidget.setAttribute("id", "presence-widget");
        $(lyncWidget).appendTo(container);
        $("#presence-widget").text(Instant.sipUri);
    }
};
The link to our example page can be found here: http://instant-tech.com/examples/lync-presence

Simply add a SIP URI (formatted: johndoe@acme.com) into the box and hit start. If you hover over the users name, it should show the full Lync widget.
Previous
Previous

Microsoft Lync Group Chat integration using C#

Next
Next

Web Client for Microsoft Lync 2010