You can use sharepoint object model you can get the email id from login user name. I have created one method to get the email ID after passing the user first and last name.
I have used Microsoft Sharepoint SiteUserInfoList library, you can find all the imported user details in this list.

public string getEmail(string firstName,lastName)
{
string emailID = "";
try
{
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();
break;
}
}
}
catch (Exception ex)
{
throw ex;
}
return emailID;
}

Usage example,

string testName=getEmail("Sandesh","MM");

Same way you can customize above method to get the email id from login username.  If you found any good approaches just write down, it may helps to someone.
Enjoy coding 🙂
Sandesh

Similar Topics:

Tags:

SiteUserInfoList sharepoint 2010sharepoint get user emailsharepoint siteuserinfolist