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
SPList resourceList = SiteProvisioningProvider.GetListReference(web, "Lists/list");
                foreach (SPFieldUserValue admin in adminCollection)
                    SPListItem resourceItem = resourceList.Items.Add();
                    string name = admin.User.Name;
                    resourceItem["FirstName"] = name.Split(' ')[0].ToString();
                    resourceItem["Email"] = admin.User.Email;//null
                    web.SiteGroups["Engagement Administrator"].AddUser(admin.User);

Above code is returning email and name of the user infomation. The same methos is called when i click some button in sharepoint site and also timer job calling the same method. But nly in the timer job i am not getting any email id for any user in any domain. This is happening is production environment not with QA/DEV. What will be the issue?
share|improve this question
your code run inside SPSecurity.RunWithElevatedPrivileges(delegate() { }); ?? and other thing is check in userprofile that email is added or not – Vishal_Sharepoint Aug 27 '12 at 11:37
yep, email added properly.same code work every where except it get called from the timmer job. – My Name is Suresh Aug 27 '12 at 11:48
up vote 0 down vote accepted

you can find sharepoint all user from hidden list named "User Information List". and its url like this "siturl/_catalogs/users/simple.aspx". using this list you can fetch all email id of sharepoint users.

public string getEmail(string firstName,lastName)
string emailID = "";
     SPListItemCollection spListItemColl = Site.RootWeb.SiteUserInfoList.Items;
     foreach (SPListItem item in spListItemColl)
         //Checking for first and last name
      if (item["FirstName"] != null && (firstName.ToUpper() == item["FirstName"].ToString().ToUpper()) && item["LastName"] != null && (lastName.ToUpper() == item["LastName"].ToString().ToUpper()) && item["EMail"] != null)
  emailID = item["EMail"].ToString();
catch (Exception ex)
throw ex;
return emailID;

you can also see this link might be helpful for you:

share|improve this answer

Hi please check this ans.

share|improve this answer
this post talking about the the current user. my issue is with all the users. – My Name is Suresh Aug 27 '12 at 12:02

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.