Getting SharePoint User Profile Peers
Using SharePoint User Profiles is an exceedingly influential option when working with additional SharePoint user data. One impressive method is the GetPeers() method which as the name implies, allows you to query down into user peers from a profile object. The GetPeers method returns an array of User Profile objects, which you can later iterate through in order to perform whatever operations you desire. For my particular example, I was writing hierarchal user data, so coupled the GetPeers() method with the GetManager() method to build visual representation of organizational hierarchy.
-
public List<UserProfile> GetUserProfilePeerData(string url)
-
{
-
SPSecurity.CatchAccessDeniedException = false;
-
{
-
foreach (UserProfile profile in manager)
-
{
-
foreach (UserProfile peerProfile in profile.GetPeers())
-
{
-
peerProfiles.Add(peerProfile);
-
}
-
}
-
}
-
return peerProfiles;
3 Comments »
RSS feed for comments on this post. TrackBack URL























Articles & Research
SharePoint Architecture
Personal/Off-Topic
Article Or Research Filed Under 

[...] Getting SharePoint User Profile Peers [...]
Pingback by Links (7/27/2008 « Steve Pietrek - Everything SharePoint) — July 27, 2008 @ 5:22 pm
I am trying to do something along the same line. I am trying to write an Custom Organizational Hierarchy webpart of my own. I was wondering if you could pass along some advice on how to go about doing this
Thanks
Comment by Dave Lewis — December 5, 2008 @ 9:44 am
How do you get a list of all users.I am trying to populate a dropdown of users with an action based on selection.
Thx
Comment by Anonymous — May 20, 2009 @ 11:52 am