Поделиться через


Integrating Lync feature in an Asp.net web Application.

You may have seen in most of the asp.net web applications where when you hover your cursor on an author of the document, you see a  Lync presence orb next to the authors name. in this blog post we are going to see how this is implemented using ActiveX controls through an on-object user interface (UI).

the above figure gives you the picture of how it looks like.

 

Implementation.

1) Open new instance of the visual studio and create a Empty Asp.net web application and give it a name ( here LyncPresence)


2) open the LyncPresence.aspx page and with in the form tag write the following code.

<form id="form1"runat="server">

 <span onmouseover="ShowOOUI()"onmouseout="HideOOUI()"style="border-style:solid">Rithesh Baradi</span>

 </form>

 

I have Created a Span tag with the Name in it. on the hover (On Mouse Over) of this name we want to show the Lync presence orb right next to it and when the Mouse out we need to hide the Lync presence orb. this is done by using a simple java script and NameCtrl ActiveX object.

 

add the following code in the Head tag of the LyncPresence.aspx page.

<script type="text/javascript">

 //Provide the email id or uri of the Lync contact you want to show. 

 var EmailID = RitheshBaradi@xyz.com

//Creating the ActiveX component of NameCtrl which is present in C:\Program Files\MicrosoftOffice\Office14\NAME.dll

 var nameCtrl = new ActiveXObject('Name.NameCtrl.1');

//ShowOOUI function to display the Presence Orb.

 function ShowOOUI() {

 nameCtrl.ShowOOUI(EmailID, 0, 15, 15);

 }

//HideOOUI function to hide the Presence Orb.

 function HideOOUI() {

 nameCtrl.HideOOUI();
 
 }
 </script>

Understanding the Code.

The ShowOOUI method displays the on-object UI and has 4 parameters:

  • bstrName: Contains the logon name of the user (Usually the corporate email address)
  • iInputType: indicates if the user used the mouse or keyboard to open the on-object UI.
  • xLeft: Specifies in pixels the x-coordinate of the location to display the on-object UI relative to the top-left corner of the application window.
  • yTop: Specifies in pixels the y-coordinate of the location to display the on-object UI relative to the top-left corner of the application window.

The HideOOUI method hides the on-object UI.

 

Run the code and hover your cursor on the name you can see the Lync presence orb right next to the name.

 

Note :-   To successfully implement this piece of code, following things should be taken care of.

  1. This feature  will only work on Internet Explorer,  as we have already discussed  that this is achieved through ActiveX component.
  2. Lync must be installed on the computer ( preferably for the corporate web applications/Intranet)

Comments

  • Anonymous
    February 26, 2014
    Interesting. Is is possible to show the status as an image?

  • Anonymous
    July 23, 2014
    This is very informative article. Please help me how we can get all users status from my Lync contacts list and display on my webpage. ? Thanks in advance.

  • Anonymous
    December 20, 2014
    Its not even working in IE11 May I know is there any way to achieve in IE11,please help