kamagra how much to take

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.

  1. public List<UserProfile> GetUserProfilePeerData(string url)
  2. {
  3. SPSecurity.CatchAccessDeniedException = false;
  4. List<UserProfile> peerProfiles = new List<UserProfile>();
  5. using (SPSite site = new SPSite(url))
  6. {
  7. UserProfileManager manager = new UserProfileManager(ServerContext.GetContext(site));
  8. foreach (UserProfile profile in manager)
  9. {
  10. foreach (UserProfile peerProfile in profile.GetPeers())
  11. {
  12. peerProfiles.Add(peerProfile);
  13. }
  14. }
  15. }
  16. return peerProfiles;
Share

2 Comments

  1. Dave Lewis says:

    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

  2. Anonymous says:

    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

Trackbacks/Pingbacks

  1. Links (7/27/2008) « Steve Pietrek - Everything SharePoint - [...] Getting SharePoint User Profile Peers [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>