Get the SPUser Object Details from SharePoint ListItem
private SPUser GetSPUser(SPListItem item, string key)
{
SPFieldUser field = item.Fields[key] as SPFieldUser;
if (field != null && item[key] != null)
{
SPFieldUserValue fieldValue = field.GetFieldValue(item[key].ToString()) as SPFieldUserValue;
if (fieldValue != null)
{
return fieldValue.User;
}
}
return null;
}
private SPUser GetSPUser(SPListItem item, string key)
{
SPFieldUser field = item.Fields[key] as SPFieldUser;
if (field != null && item[key] != null)
{
SPFieldUserValue fieldValue = field.GetFieldValue(item[key].ToString()) as SPFieldUserValue;
if (fieldValue != null)
{
return fieldValue.User;
}
}
return null;
}
Comments
Post a Comment