SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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 know that;

SPWeb.EnsureUser(string loginName);

can be used to add Domain Users with login name, to the site users. But i have a list with only email addresses. How can i add these people to site users?

Is there anyway to get loginName from email address? Or any other way?

share|improve this question
up vote 3 down vote accepted

How about using the following function, Microsoft.SharePoint.Utilities.SPUtility.ResolveWindowsPrincipal()?

It has the following parameters:-

webAppType: Microsoft.SharePoint.Administration.SPWebApplication

inputType: System.String

scopesType: Microsoft.SharePoint.Utilities.SPPrincipalType

inputIsEmailOnlyType: System.Boolean

There are two overloads, suggest you use the SPWebApplication one.

More information at

You can then use the information returned as part of the SPPrincipalInfo object to get the login name to call Ensure User.

share|improve this answer
If that doesn't work. Why dont you just write code to retrieve the domain name from Active Directory using the Email address. Should be pretty simple to do. – Fox Feb 1 '13 at 12:44

Your Answer


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.