Following piece of code returning following error not sure where is the problem,
Exception Details: System.ArgumentException: Value does not fall within the expected range.
public static SPUser convertStringToSPUser(string struser)
{
SPFieldUserValue userValue = new SPFieldUserValue(SPContext.Current.Web, struser);
SPUser objSPUser = userValue.User;
return objSPUser;
}
My string is something like, “S, Rishi”.
In order to create an instance of SPFieldUserValue you should Pass a string with the following format:
[int];#[domain]\[username]
The easiest way to get that value from a list item is:
ListItem[field_GUID].ToString();