Thursday, May 31, 2012

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.

8 comments:

Smile Arrow said...

Smilearrow Find best products values got thousands of online top most bought items key points, rankings, price, photos lot of cool stuff to get from

Pankaj Ogeninfo said...

Amazing Blog, Visit for the best Web Designing Company for creative and Dynamic Website’s.
Website Designing Company in Delhi

Mutual Fundwala said...

Nice Blog, Mutual Fund Wala provide you the latest mutual fund schemes and mutual fund companies. Visit Mutual Fund Wala for More Information-
Mutual Fund Distributor

Poojarao said...

Rice Bags Manufacturers
Pouch Manufacturers
wall putty bag manufacturers

Poojarao said...

we have provide the best ppc service.
ppc agency in gurgaon
website designing company in Gurgaon
PPC company in Noida

Poojarao said...

we have provide the best fridge repair service.
fridge repair in faridabad
Videocon Fridge Repair in Faridabad
Whirlpool Fridge Repair in Faridabad
Washing Machine Repair in Noida
godrej washing machine repair in noida
whirlpool Washing Machine Repair in Noida
IFB washing Machine Repair in Noida
LG Washing Machine Repair in Noida

Poojarao said...

Bali Honeymoon Packages From Delhi
Bali Honeymoon Packages From Chennai
Hong Kong Packages From Delhi
Europe Packages from Delhi
Bali Honeymoon Packages From Bangalore
Bali Honeymoon Packages From Mumbai
Maldives Honeymoon Packages From Bangalore
travel company in Delhi

Kala Kutir said...

Awesome information and content in this blog, thanks for this. Visit lifestyle magazine for night parties and enjoyments events.
Lifestyle Magazine India