Hello Friends
Here is the code how to get the SPUser Object from SPfield(Person or Group) from a sharepoint list and get the email address, login name of that user.
Here is a snippest of code.
SPFieldUser userField = (SPFieldUser)SPContext.Current.Web.Lists["SiteName"].Fields.GetField("AdminName");
SPFieldUserValue fieldValue = (SPFieldUserValue)userField.GetFieldValue(myitem["AdminName"].ToString());
SPUser user = fieldValue.User;
//user.LoginName;
Happy Coding
Disha Shah!!!
Here is the code how to get the SPUser Object from SPfield(Person or Group) from a sharepoint list and get the email address, login name of that user.
Here is a snippest of code.
SPFieldUser userField = (SPFieldUser)SPContext.Current.Web.Lists["SiteName"].Fields.GetField("AdminName");
SPFieldUserValue fieldValue = (SPFieldUserValue)userField.GetFieldValue(myitem["AdminName"].ToString());
SPUser user = fieldValue.User;
//user.LoginName;
Happy Coding
Disha Shah!!!
No comments:
Post a Comment