SPUser.Name property

Gets or sets the display name of the user.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

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.

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.