/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static SPUser GetUser(this SPListItem item, string displayName) { //get field and cast to User Field type var field = item.Fields.GetField(displayName) as SPFieldUser; if (null == field) { } var fieldValue = field.GetFieldValue(item[field.Id].ToString()) as SPFieldUserValue; SPUser user = null; if (null != fieldValue) { user = fieldValue.User; } return user; }