I have a search function that returns an email address for a user when I have a user ID
private string getUserEmail(string userID)
{
string userEmail = null;
SPGroupCollection collGroups = SPContext.Current.Web.Groups;
int userIDint = Convert.ToInt32(userID);
foreach (SPGroup oGroup in collGroups)
{
userEmail = oGroup.Users.GetByID(userIDint).Email.ToString();
}
return userEmail;
}
with users I can use GetByID or GetByEmail, but what should I do if I have a domain name such as MyDomain \ myUsername and want to receive an email for this user?
Any help or links would be appreciated.
Thanks in advance.
source
share