Export (0) Print
Expand All
Expand Minimize

SPWeb.Title Property

Windows SharePoint Services 3

Gets or sets the title for the Web site.

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

public string Title { get; set; }

Property Value

Type: System.String
A string that contains the title.

If you set the value of the Title property, you must call the Update method for changes to take effect in the database.

The following code example uses the Title property to change the title of a specified Web site in the current site collection.

using(SPWeb oWebsite = SPContext.Current.Site.OpenWeb("Website_URL"))
{
    oWebsite.Title = "New Website Name";
    oWebsite.Update();
}
NoteNote

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 Best Practices: Using Disposable Windows SharePoint Services Objects.

Community Additions

ADD
Show:
© 2014 Microsoft