I am working on a Lync presence Indicator in Sharepoint.

I have read this Article for adding presence indicator and it works fine if I add HTML static. But when I add HTML Dynamically it doesn't work anymore. I would wants to know why this not work when dynamically added?

I have also tried to add HTML through console. But this also does not work.

Here is my code which I am adding dynamically.

html += "<span class='ms-imnSpan'><a href='#' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink ms-spimn-presenceLink'><span class='ms-spimn-presenceWrapper ms-imnImg ms-spimn-imgSize-10x10'><img name='imnmark' title='' ShowOfflinePawn='1' class='ms-spimn-img ms-spimn-presence-disconnected-10x10x32' src='/_layouts/15/images/spimn.png?rev=23' alt='User Presence' sip='kaushal.khamar@xxxxx.com' id='imn_1,type=sip' /></span></a></span>";

I have gone through this Question but it's not a solution.

Does the presence indicator work if I add this HTML dynamically?


If you create the DOM dynamically, you have to call IMNRC function with the correct parameters:

IMNRC('user-sip', domelement)

In your case you should execute this after creating the DOM:

IMNRC('kaushal.khamar@xxxxx.com', document.getElementById('imn_1,type=sip'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.