This topic has not yet been rated - Rate this topic

SPFieldUserValue Class

Contains the value for an SPFieldUser object.

System.Object
  Microsoft.SharePoint.SPFieldLookupValue
    Microsoft.SharePoint.SPFieldUserValue

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
[SubsetCallableTypeAttribute]
[ClientCallableTypeAttribute(Name = "FieldUserValue", ServerTypeId = "c956ab54-16bd-4c18-89d2-996f57282a6f", 
	ValueObject = true)]
public class SPFieldUserValue : SPFieldLookupValue
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Parsing With SPFieldUserValue With Extension Methods

When using SPFieldUserValue to hydrate properties like SPFieldUserValue.Login, it is best to use consistent extension methods as demonstrated below:

public static string GetUserLogin(this SPListItem item, string fieldName)
{
var userValue = new SPFieldUserValue(item.Web, (string) item[fieldName]);
return userValue.User != null ? userValue.User.LoginName : string.Empty;
}

Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com