Tarasov
Tarasov

Reputation: 3695

Can I use a Lync api in my asp.net application?

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.

Upvotes: 1

Views: 9495

Answers (2)

SteveCav
SteveCav

Reputation: 6729

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 = "[email protected]";
  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>

Upvotes: 0

Carlos Landeras
Carlos Landeras

Reputation: 11063

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/

Upvotes: 4

Related Questions