Getting colleagues for the current user from user's user profile is much easier.
Lets look at an example -
ServerContext siteContext = ServerContext.GetContext(siteCollection);
UserProfileManager oUserProfileManager = new UserProfileManager(siteContext);
UserProfile oUserProfile = oUserProfileManager.GetUserProfile(_spUser.LoginName);
foreach (Colleague colleague in oUserProfile.Colleagues.GetItems())
{
//Get colleagues
}
No comments:
Post a Comment