Partager via


SPWeb.Update Method

Updates the database with changes that are made to the Web site.

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

Syntax

Public Sub Update

Dim instance As SPWeb

instance.Update()
public void Update()

Examples

The following code example uses the Update method to change the title of a specified site in the current site collection.

Using webSite As SPWeb = SPContext.Current.Site.OpenWeb("Site_Name")
    webSite.Title = "New_Site_Name"
    webSite.Update()
End Using
using (SPWeb oWebsite = SPContext.Current.Site.OpenWeb("Website_URL"))
{
    oWebsite.Title = "My New Title";
    oWebsite.Update();
}

Note

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.

See Also

Reference

SPWeb Class

SPWeb Members

Microsoft.SharePoint Namespace