Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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.

M.

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 username@domain.com 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.

Lori

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top