1

hi can I get the lync contacts and them status in a listview with C#? I want to get all users from ad to a listview in asp.net web application and control wheater a user is online or offline.

Tarasov
  • 3,625
  • 19
  • 68
  • 128

2 Answers2

4

Yes you can. Check the following links to integrate lync in asp.net applications:

Lync integration:

http://sharpsplash.wordpress.com/2012/08/03/integrate-microsoft-lync-into-a-asp-net-web-application/

Show MS Lync presence status:

http://htmlpresencecontrols.codeplex.com/

Carlos Landeras
  • 11,025
  • 11
  • 56
  • 82
0

If Carlos' links do go dead, here is the TL;DR. This Javascript taps into the NAME.dll in C:\Program Files\MicrosoftOffice\Office14:

<script>
  $(function() {
    //hide the ooui if the user scrolls.
    (window).scroll(function() {
      HideOOUI();
    });

    $('#lyncspan').hover(function() {
        //show ooui on mouseover event
        ShowOOUI();

    }, function() {
        //hide ooui on mouseout event
        HideOOUI();

    });
  });

  var sipUri = "your.contact@your.domain.com";
  var nameCtrl = new ActiveXObject('Name.NameCtrl.1');

  if (nameCtrl.PresenceEnabled)
  {
    nameCtrl.OnStatusChange = onStatusChange;
    nameCtrl.GetStatus(sipUri, "lyncspan");
  }

  function onStatusChange(name, status, id)
  {
    //In a real world application you would display
    //a status icon instead of an alert
    alert(name + ", " + status + ", " + id);
  }

  function ShowOOUI()
  {
    nameCtrl.ShowOOUI(sipUri, 0, 15, 15);
  }

  function HideOOUI()
  {
    nameCtrl.HideOOUI();
  }

</script>
<span id="lyncspan" style="border-style: solid">Your Contact<span>
SteveCav
  • 6,649
  • 1
  • 50
  • 52