There is no straight way to convert "personorgroup" field to SPUser object. Here the way to convert it using SPFieldUser object.
private SPUser GetUser(SPListItem item, SPField userField)
{
string currentValue = item[userField.Title].ToString();
SPFieldUser field = (SPFieldUser)userField;
SPFieldUserValue fieldValue = (SPFieldUserValue)field.GetFieldValue(currentValue);
return fieldValue.User;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment