Is there a way to retrieve the currently logged in user's colleagues' usernames?

I found this which shows how to do it using server object model, but haven't found anything for JavaScript object model.


I might be wrong, but isnt Colleagues the same as SPS-Peers? If so you could get it with UserProfiles.


function getPeers() {
    var context = SP.ClientContext.get_current();
    var peopleManager = new SP.UserProfiles.PeopleManager(context);
    userProfileProperties = peopleManager.getMyProperties();
    context.load(userProfileProperties, 'Peers');
    context.executeQueryAsync(success, fail);
function success(){
  var peers = userProfileProperties.get_peers();
  console && console.dir(peers);

function fail(sender, args) {
 console && console.log("Error");

SP.SOD.loadMultiple(['sp.js', 'userprofile'],function() {
| improve this answer | |
  • 1
    Hmm.. an interesting idea, according to this support.office.com/en-sg/article/… My Colleagues category includes your manager, your peers, and your direct reports – Vadim Gremyachev Apr 8 '15 at 9:28
  • @VadimGremyachev So if one includes the Properties; DirectReports/ExtendedReports and ExtendedManagers you would have the same result – Anders Aune Apr 8 '15 at 10:06
  • Thanks for this suggestion. I'll give it a try and get back. – Submits Apr 9 '15 at 11:48
  • So this solution seems to work. However, I don't get back ALL of the user's colleagues, as setup in Active Directory. I have a feeling this is possibly because they don't all have user profiles on SharePoint as some have not yet logged onto our new SharePoint site - what do you think? Any way to get around this so that all colleagues are returned regardless of whether they have a user profile on SharePoint or not? Thanks. – Submits Apr 13 '15 at 8:48
  • @Submits I don't think you can get all the Peers without syncing all the Users. They don't have to be logged in for the Profile to be created, just mysite is created the first time they click on about me. Do you see the missing people in the UserProfile Service if you search for AD-users there? If not, make sure you sync all the users to the User Profile Service. – Anders Aune Apr 13 '15 at 10:03

Unfortunately it does not seem possible to archive via SharePoint CSOM/JSOM API since SSOM ColleagueManager class is not supported in CSOM/JSOM API.

But you could utilize SharePoint Web Services, in particular UserProfileService.GetUserColleagues method for that purpose:

SPServices example:

    operation: "GetUserColleagues", 
    AccountName: $().SPServices.SPGetCurrentUser({fieldName: "Name"}), 
    completefunc:function(data,status) {
        //process GetUserColleaguesResult... 
| improve this answer | |
  • 1
    Thanks for your suggestion. I shall give it a try and get back. – Submits Apr 9 '15 at 11:48
  • 1
    I prefer the answer by Anders on this occasion as it does not require the use of SPServices. Many thanks for your help. – Submits Apr 13 '15 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.