SPUser.Name Property

Gets or sets the display name of the user.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online


<ClientCallableAttribute(Name := "Title")> _
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.NotEmpty)> _
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.MaxLength, Value := )> _
Public Overrides Property Name As String
Dim instance As SPUser
Dim value As String

value = instance.Name

instance.Name = value
[ClientCallableAttribute(Name = "Title")]
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.NotEmpty)]
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.MaxLength, Value = )]
public override string Name { get; set; }

Property Value

Type: System.String
A string that contains the display name.


To modify the display name for a user by setting the value of the Name property, call the Update method to effect the changes in the database.


The following code example modifies the display name for a specified user object.

Dim siteCollection As SPSite = SPControl.GetContextSite(Context)
Dim site As SPWeb = siteColl.AllWebs("Site_Name")
Dim user As SPUser = site.AllUsers("User_Name")

user.Name = "Display_Name"

using (SPSite oSiteCollection = SPContext.Current.Site)
    using (SPWeb oWebsite = oSiteCollection.AllWebs["Website_Name"])
        SPUser oUser = oWebsite.AllUsers["User_Name"];
        oUser.Email = " E-mail_Address";
        oUser.Name = " Display_Name";
        oUser.Notes = " User_Notes";


Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

See Also


SPUser Class

SPUser Members

Microsoft.SharePoint Namespace