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)


Public Shared Function Exists ( _
    uri As Uri, _
    checkContentDb As Boolean _
) As Boolean
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


  • uri
    Type: System.Uri

    The exact, absolute url of a site. i.e. http://server/sites/sitename, not http://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


SPSite class

SPSite members

Exists overload

Microsoft.SharePoint namespace