I am looping through a group of UserPrincipal that was retrieved from Active Directory. I need to get find a SPUser using the properties of the UserPrincipal. Once the SPUser is found I will get its UserProfile["PreferredName"].
I have tried passing all of the following to SPUser and the exception says user not found:
UserPrincipal.UserPrincipalNameUserPrincipal.DisplayName
I should also mention the reason I need to find the Preferred Name is because the UserPrincipal.DisplayName that I will eventually pass to a People Picker is resolving as the Preferred Name which I am afraid will mess us up later. I have already synced the Preferred Names, there are just a couple that are stuck as 'domain/username' instead of 'firstname lastname'.
Any ideas?