2

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 presence 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

keeney
  • 893
  • 8
  • 21

2 Answers2

2

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

Paul Nearney
  • 6,965
  • 2
  • 30
  • 37
  • Paul, I'm wrapping everything in a [if (nameCtrl.PresenceEnabled) { }] presence is working and I can change my status in communicator and it updates my icon in the webpage. It still won't populate any of the other details email, department, phone etc. and I still don't get an organization tab. Do you get these details in your custom apps? – keeney Feb 22 '11 at 11:00
  • Just a hunch - are you prefixing the sip uri of your contact with "sip:"? if so, try removing it, if not, try adding it. I'll give this a test when my VM fires up – Paul Nearney Feb 22 '11 at 11:35
  • Also, just as a sanity check, make sure that the info you are interested in is actually being fetched by Lync or Communicator (which are you using, btw?) - you should be able to do this by viewing the contact card of your contact. If Lync/Communicator isn't displaying this info, then NameCtrl won't be able to – Paul Nearney Feb 22 '11 at 12:14
  • I'm getting the same functionality (presence) with the sip: prefix and without. Still no AD details though. – keeney Feb 22 '11 at 13:00
  • I'm using office communicator. Viewing someone's contact card give me the when they are next free, job description, department etc. – keeney Feb 22 '11 at 13:01
  • I can't see what I'm doing different to Sharepoint (which gives me full details and an organisation tab). – keeney Feb 22 '11 at 13:01
  • I've checked on my test environment, and I can't replicate the problem you're having - as long as Lync/Communicator is showing the info, it gets shown in NameCtrl. Some things to check: 1: Which IE zone is your app running in? 2: Is your machine domain joined, and are you logged in on the box and into communicator as the same user? 3: If using vista/Win7, are Communicator and IE running at the same UAC level? Other than that, I can't see any reason why Sharepoint and your app are displaying different info - maybe post your code up here? – Paul Nearney Feb 23 '11 at 10:29
0

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.

James Love
  • 1,025
  • 9
  • 16
  • 1
    -1, as the data is pulled back from Lync/Communicator, not SharePoint. NameCtrl iself is responsible for caching all the data, shouldn't be any need to cache anything yourself – Paul Nearney Feb 19 '11 at 08:24