SPSite.Exists method (Uri, Boolean)

Determines if a site with the specified uri exists. Checks the config db cache and, additionally, checks the content database if checkContentDb is true.

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

Syntax

'Declaration
Public Shared Function Exists ( _
    uri As Uri, _
    checkContentDb As Boolean _
) As Boolean
'Usage
Dim uri As Uri
Dim checkContentDb As Boolean
Dim returnValue As Boolean

returnValue = SPSite.Exists(uri, checkContentDb)
public static bool Exists(
    Uri uri,
    bool checkContentDb
)

Parameters

  • uri
    Type: System.Uri

    The exact, absolute url of a site. i.e. https://server/sites/sitename, not https://server/sites/sitename/subweb/default.aspx

  • checkContentDb
    Type: System.Boolean

    If true, does a deep check to see if the site collection is really existing in a content database. Otherwise, just looks up the site in config db cache, which may or may not be fresh.

Return value

Type: System.Boolean
true if the site exists; otherwise, false.

See also

Reference

SPSite class

SPSite members

Exists overload

Microsoft.SharePoint namespace