SPSite.Rename method

Changes the URL of a host-header-named site collection to a new URL.

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

public void Rename(
	Uri newUri
)

Parameters

newUri
Type: System.Uri

A System.Uri object that represents the new URL.

ExceptionCondition
ArgumentNullException

newUri is null .

NoteNote

For builds prior to the March 2015 CU, you can't use the Rename method to convert a host-header-named site collection to a path-based site collection or vice versa.

The new URL must be reachable in the web application and must not already be used as an alternate access-mapping URL.

After the site rename, an app pool recycle is recommended to force refreshing the cache.

Show: