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)

Syntax

'Declaration
Public Sub Rename ( _
    newUri As Uri _
)
'Usage
Dim instance As SPSite
Dim newUri As Uri

instance.Rename(newUri)
public void Rename(
    Uri newUri
)

Parameters

  • newUri
    Type: System.Uri

    A System.Uri object that represents the new URL.

Exceptions

Exception Condition
ArgumentNullException

newUri is null .

Remarks

Note

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.

See also

Reference

SPSite class

SPSite members

Microsoft.SharePoint namespace