/// Gets the SPUser from field of Sharepoint list
/// 
/// <param name="aItem">The item.
/// <param name="aIntenalName">The internal field name
/// 
private SPUser GetSPUser(SPListItem aItem, string aIntenalName)
{
	SPFieldUser field = aItem.Fields.GetFieldByInternalName(aIntenalName) as SPFieldUser;

	if (field != null && aItem[aIntenalName] != null)
	{
		SPFieldUserValue fieldValue = field.GetFieldValue(aItem[aIntenalName].ToString()) as SPFieldUserValue;

		if (fieldValue != null)
		{
			return fieldValue.User;
		}
	}

	return null;
}

 Sharepoint list fields of type "User and Group" in object model as read as string, for example system field "Author", with this code you can getting this type of fields in the correct form. 

相关文章:

猜你喜欢
相关资源
相似解决方案