Search code examples
asp.netintegrationinstant-messagingoffice-communicator

Launch Office Communicator from asp.net


On an intranet I am building there is a need to have instant messaging. The client already uses the Office Communicator application so I would like to use that if possible.

The Intranet will have an employee directory and I would like to have a "call" button next to each employee which will launch the Communicator application. I do not know if the client has the Communicator Web Access component and we may not be able to get it installed at all. How should I go about this integration?


Solution

  • There shouldn't be any need to install Web Access. You can do everything client-side using the existing NameCtrl persona menu - this is the pop-up menu that gets displayed in SharePoint (and other web-based apps like Dynamics CRM) when hovering over a users presence icon. This menu allows you to call the user, start a new conversation etc. You'd need Office installed on the machine you are running on in order for it to work.

    As an example, try this on any client machine running Office 2007/2010 and IE. Hover over the "Your Contact" text to see the persona menu (your site will need to be added to the Trusted Sites or Intranet zone):

    <script>
    
    var sipUri = "[email protected]";
    
    var nameCtrl = new ActiveXObject('Name.NameCtrl.1');
    if (nameCtrl.PresenceEnabled)
    {
      nameCtrl.OnStatusChange = onStatusChange;
      nameCtrl.GetStatus(sipUri, "1");
    }
    
    
    function onStatusChange(name, status, id)
    {
      // This function is fired when the contacts presence status changes.
      // In a real world solution, you would want to update an image to reflect the users presence
      alert(name + ", " + status + ", " + id);
    }
    
    function ShowOOUI()
    {
      nameCtrl.ShowOOUI(sipUri, 0, 15, 15);
    }
    
    function HideOOUI()
    {
      nameCtrl.HideOOUI();
    }
    
    </script>
    
    <span onmouseover="ShowOOUI()" onmouseout="HideOOUI()" style="border-style:solid">Your Contact</span>