public List<userprofile> GetUserProfilePeerData(string url)
{
SPSecurity.CatchAccessDeniedException = false;
List<userprofile> peerProfiles = new List<userprofile>();
using (SPSite site = new SPSite(url))
{
UserProfileManager manager = new UserProfileManager(ServerContext.GetContext(site));
foreach (UserProfile profile in manager)
{
foreach (UserProfile peerProfile in profile.GetPeers())
{
peerProfiles.Add(peerProfile);
}
}
}
return peerProfiles;
{
SPSecurity.CatchAccessDeniedException = false;
List<userprofile> peerProfiles = new List<userprofile>();
using (SPSite site = new SPSite(url))
{
UserProfileManager manager = new UserProfileManager(ServerContext.GetContext(site));
foreach (UserProfile profile in manager)
{
foreach (UserProfile peerProfile in profile.GetPeers())
{
peerProfiles.Add(peerProfile);
}
}
}
return peerProfiles;