Get an SPuser from a field name in SharePoint List.
protected SPUser GetUser(SPListItem item, string user)
{
SPUser theuser = null;
SPFieldUserValue uv= new SPFieldUserValue(item.Web, Convert.ToString(item[user]));
if (null != uv)
{
theuser = userValue.User;
}
return theuser;
}
You can then proceed to get the different output from the returned SPUser object: e.g. LoginName, Email
protected SPUser GetUser(SPListItem item, string user)
{
SPUser theuser = null;
SPFieldUserValue uv= new SPFieldUserValue(item.Web, Convert.ToString(item[user]));
if (null != uv)
{
theuser = userValue.User;
}
return theuser;
}
You can then proceed to get the different output from the returned SPUser object: e.g. LoginName, Email
Comments