Microsoft.SharePoint


SPFieldUserValue Class (Microsoft.SharePoint)
Contains the value for an SPFieldUser object.

Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
Public Class SPFieldUserValue
    Inherits SPFieldLookupValue
Visual Basic (Usage)
Dim instance As SPFieldUserValue
C#
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
public class SPFieldUserValue : SPFieldLookupValue
Inheritance Hierarchy

System.Object
   Microsoft.SharePoint.SPFieldLookupValue
    Microsoft.SharePoint.SPFieldUserValue
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Tags :


Community Content

Thomas Lee
usage example: easily differentiating between users and groups for a given SPFieldUserValue

SPFieldUserValue userValue = (assigned prior to this code section)

string userOrGroupName = null;

// userValue refers to a group
if (userValue.User == null)
userOrGroupName = userValue.LookupValue;
else // userValue refers to a user
userOrGroupName = userValue.User.LoginName;

SPWorkflowTaskProperties childTaskCreationProperties = new SPWorkflowTaskProperties ();
childTaskCreationProperties.AssignedTo = userOrGroupName;



Page view tracker