I need a WebPart similar to Colleagues WebPart, but to return which users have added me as a Colleague.

Does it already exist? Or, how can I develop it? I'm using SharePoint 2010.

  • Welcome to SharePoint Stack Exchange! Please tag by feature or topic and not by version or product. This helps to attract more attention to your question and keep it relevant. See How do I use tags for general guidelines. – Alex Angas Sep 11 '11 at 23:06

I've put some thought into this request before, and again today when I read your post here. The problem is that the API does not support this type of lookup. Its unfortunate, and a glaring gap in the current product.

As John Chapman mentioned, if you were to iterate through every profile in the system it is likely to take awhile and will not scale well. For processes like this, or to handle things like "this week's birthdays" and other social listings, the best way to handle it seems to be to write a scheduled process that can prep the data so that it is available when needed. Specifically I would write a timer job that calls a web service to initiate the processing and have it write the data out either to a back end database or to a SharePoint list.

The time it would take to process will vary based on the number of users in the system and how many connections everyone establishes. If it is something that needs to be updated daily it shouldn't be a big deal, but hourly may not be a good idea in larger environments.

  • Thank you Mike, I was expecting something like this. I will take into account doing a scheduled process. Nice idea! – Bargant Sep 12 '11 at 7:02

I have been working on a similar type of web part. In going through the SharePoint object model for user profiles, the only function that exists for determining the colleague relationship is on a one-by-one using the IsColleague function of the ColleageManager: http://msdn.microsoft.com/en-us/library/ms491859.aspx

What this means is in order to find out who has you listed as a colleague, you would have to do a for-each statement on every profile to see if you are listed as their colleague. In my situation, I had 2400 profiles and it took 20+ seconds to run that function. Not very efficient for loading the information into a web part.

The alternative work-around, though not a recommended way of doing things, is to query the Profile database directly in SQL. You could do a join query that pulls the UserProfile RecordID that matches your NT login, then join the colleagues table matching the RecordID, and then join the UserProfile table for all usernames that match the RecordIds from the colleagues table.

  • 1
    Do not access the database directly, it will cause a lot of havoc. – Mike Oryszak Sep 11 '11 at 13:49
  • I agree, however only mentioned it since the only method provided in the object model won't work for a large set of profiles. – John Chapman Sep 11 '11 at 15:44
  • The problem is that it's not supported by Microsoft, and is not a solution that should be used in a production environment. – Alex Angas Sep 11 '11 at 23:07
  • Again, I agree with that. Was simply expressing the only available alternative, albeit not a good one. – John Chapman Sep 12 '11 at 4:21
  • Thank you for your answer. The problem is that our environment have more than 8000 users and 20 seconds are too many for us, besides all the other problems commented before. – Bargant Sep 12 '11 at 7:10

In Sharepoint 2013: Newsfeed >> Click on "I'm following: {number}" (goes to http://mysites.example.com/MyPeople.aspx) and from there see "I'm following" and "My followers" links.

'I'm Following' screenshot screenshot with highlighted 'My Followers' link

It's not a web part but does show the information asked for.

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.