开发者

presence control in asp.net web applications

I've managed to implement the Name.NameCtrl.1 active x used in sharepoint in my own custom built apps for presence. All is working fine and I'm updating p开发者_开发知识库resence status correctly based on a users status on Office Comunication Server. However I'm not getting any other details on the user propulated in the presence control like it does in SharePoint. All I get is the sip address in the email field (rather than the real default email address in AD) and a link to schedule a meeting.

Can anyone tell me how to get the control to populate with details from AD (dept, email, phone etc) like it does in sharepoint?? Also I don't get an organization tab in the control like sharepoint.

Any ideas?

Thanks,

Keeney


NameCtrl gets the majority of its data from the running instance of Communicator (or Lync, if you're using that) on the client machine. No data is directly pulled back from SharePoint. To have NameCtrl work properly on your web pages, you need to make sure that:

  • Communicator (or Lync) is running on the client, and signed in
  • The web page you are calling NameCtrl from is in the Intranet or Trusted Sites zone in your browser

The recommended pattern is to call PresenceEnabled on the NameCtrl object before calling any other methods - if this returns false, then one (or both) of the above prereqs is false. The code below generally works for me

<script>

var sipUri = "your.contact@your.domain.com";

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>

In case you haven't already seen it, there is a good(ish) NameCtrl reference here


I think in SharePoint, the control is populated with data that exists in the user profile service. If you want this in a non-sharepoint ASP.NET web app, then you'd have to build a repository of user profile details from AD (and cache it!) which your control will look to to display that information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜