What is the best way to fetch the user profile from an e-mail address?

I have a site collection in which I have to get a hold of a MOSS UserProfile object and I only have the users e-mail address. The user is not present in the current site coll user collection, ie I cannot use the SPUtility method. NOTE: the user may not be present in the current site collection.

Only option is to use MOSS search as I can see it, but are there any alternatives?

4 Answers 4


Will it be safe to assume that the users email address is stored in the AD? In that case you might use DirectorySearcher to query for a user

  • That's another option, have to compare performance for SP Search vs AD Search. Commented Nov 13, 2009 at 11:51
  • Hi Wictor, any preliminary findings that you like to share? I have used DirectorySearcher on previous projects and I found the performance acceptable. Commented Nov 15, 2009 at 13:19
  • We could make the client to change some functionality and could skip this step, but anyways this was the solution I was going to use otherwise (combined with some in-memory caching) Commented Nov 15, 2009 at 21:56
  • i burned my fingers a couple of times on the DirectorySearcher. Problem i saw was that FindOne would ramdomly choose not to return anything even though data existed. Commented Nov 16, 2009 at 0:00

You can use the GetUserLoginFromEmail operation of the UserGroup Web Service to get the domain\username login information from the email. Then use GetUserProfileByName to grab the profile, as Lori mentions above.

Take a look at my jQuery Library for SharePoint Web Services if you'd like to do all this client side with jQuery.


  • Nice one Marc. Presumably it needs to be called on a site collection that contains the user we are looking for? I hope Wictor has that information :) Commented Nov 12, 2009 at 17:21
  • Yes, the user has to be in the Site Collection. If they weren't, where would we be looking? Using the Web Services, you can look in any other Site Collection, of course, as long as you are authenticated. Commented Nov 12, 2009 at 17:28
  • Marc, that is the problem, the user is not in the site coll. I do not want to have all 80.000+ users in everyones My Site! And that's why I'm asking... Commented Nov 12, 2009 at 17:43
  • So where are they? If they exist in another Site Collection, you can call the Web Services there. Commented Nov 12, 2009 at 19:30
  • All users exists in the profile database, and the profile database requires the username (or id) to fetch the profile. Worst case scenarios is that I have to iterate the profile database or try a number of site colls until I find the user. So I lean towards the Search method; use people search and search for the email address. Just hoped someone made a GetUserLoginFromEmail for the UserProfileManager... Commented Nov 12, 2009 at 19:42

I dont' know if this is possible in your situation. It would really depend on the structure of the email address. If the email address is the [email protected] you could parse out the username and use that to use the GetUserProfileByName operation of the UserProfileService web service. Even if that is not the format of the email, you may be able to manipulate the email with some javascript or something to get the username. Remember, you will have to use domain\username to call the user profile from the web service. I'm really not a dev, but this web service is something I use all the time.


  • Unfortunatley the username and e-mail does not even resemble each other :-( Commented Nov 12, 2009 at 17:43

How about creating your own hashtable that maps usernames to emailaddresses, for example on a custom SPPersistedObject, which gets populated by a timerjob that does iterate trough all mysites?

  • To get it performant some cache should be needed, so I don't have to hit the AD or SP Search everytime. Commented Nov 13, 2009 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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