How can i find user by nickname ?
UserProfileManager.GetManager().GetUserProfiles().Where(p => p.NickName == "xxx").SingleOrDefault();
Is it possible to doing something like this ? and for other custom fields added to basic profile ?
Hello,
Yes this is possible. I have included a code snippet retrieving the nickname of the UserProfile.
//Get the user profile manager
var pManager = UserProfileManager.GetManager();
//Retrieve the nickname
var nickname =
"myNickname"
;
//Get the nickname of the user profile
var profile = pManager.GetUserProfiles().OfType<SitefinityProfile>().Where(p => p.Nickname == nickname).FirstOrDefault();
Thanks for your reply.
I can see the NickName is in the properties list, but other custom fields not.
it generates compile error.
How can it be done for those custom field that i added to basic profile
var profile = pManager.GetUserProfiles().OfType<
SitefinityProfile
>().Where(p => p.CustomField == "xxx").FirstOrDefault();
Hi Sungyoung,
I have answered you in the support ticket.
All the best,
Victor Velev
the Telerik team
var manager = UserManager.GetManager();
var profileManager = UserProfileManager.GetManager();
//Get all users
var usersList = manager.GetUsers();
//Create an empty list to store the matching users
var usersMatchList = new List<
User
>();
foreach (User myUser in usersList)
//Load the user profile for each user
var userProfile = profileManager.GetUserProfile(myUser.Id, typeof(SitefinityProfile).FullName);
if (userProfile.GetValue<
String
>(customfield) != null)
if (userProfile.GetValue<
String
>(customfield).Contains(customvalue))
//If so, add the user to the list
usersMatchList.Add(myUser);