SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to find user-profile using the active directory email account.

Note: its not the 'work-email' but the email in AD.

share|improve this question
up vote 5 down vote accepted

SPUtility.ResolvePrincipal can do this - but I can't guarantee that it'll be fast.

It should be something like:

SPPrincipcalInfo user = SPUtility.ResolvePrincipal( webApp, null, "email", SPPrincipalType.User, SPPrincipalSource.Windows, true);
UserProfileManager profileManager = new UserProfileManager(serviceContext);
if (profileManager.UserExists(user.LoginName))
{
    UserProfile userProfile = profileManager.GetUserProfile(user.LoginName);
}

In this "email" would be your email string. It definitely works, but I have has some issues with speed. It's worth testing.

share|improve this answer
    
I get the following Error:: No Overload for the method ResolvePrincipal takes 5 arguments – user6194 Dec 29 '11 at 15:06
    
Oops, yes, forgot the second parameter, which can be null - updated example. – Andy Burns Jan 4 '12 at 16:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.