SPContentDatabase.ForceDeleteSite method (Guid, Boolean, Boolean)

Removes a site collection object from the content database when standard deletion methods are unusable.

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


Public Sub ForceDeleteSite ( _
    siteId As Guid, _
    gradualDelete As Boolean, _
    restorable As Boolean _
Dim instance As SPContentDatabase
Dim siteId As Guid
Dim gradualDelete As Boolean
Dim restorable As Boolean

instance.ForceDeleteSite(siteId, gradualDelete, _
public void ForceDeleteSite(
    Guid siteId,
    bool gradualDelete,
    bool restorable


  • siteId
    Type: System.Guid

    The GUID of the site collection that is deleted.

  • gradualDelete
    Type: System.Boolean

    true to use gradual deletion (see Remarks), false to delete immediately.

  • restorable
    Type: System.Boolean

    true to retain the SPSite object in the Gradual Site Deletion Queue for the same retention period that is configured for the Recycle Bin of the parent web application, false to delete as soon as the object is at the top of the deletion queue.


Exception Condition

restorable is true and either gradualDelete is false or the content database is an early SharePoint version that does not support restoration of deleted site collections.



This method should only be used when SPSite.Delete fails because the SPSite object was incompletely deleted or is otherwise corrupt.


Neither the WebDeleting nor the WebDeleted events, nor any other events, are raised by this method. Accordingly, no event handlers are executed by this method.

This method only removes the SPSite object from the content database. Artifacts of the site collection on the file system, if any, are not removed. Also, Active Directory accounts associated with the side are not deleted.

Passing true for gradualDelete reduces the performance impact of the deletion operation by causing the site collection content to be gradually deleted by a timer job. Gradual deletion causes rows in database tables to be deleted in small enough batches that SQL Server will lock only the affected rows, not the entire table.

The site collection is inaccessible immediately even if gradualDelete is true.

See also


SPContentDatabase class

SPContentDatabase members

ForceDeleteSite overload

Microsoft.SharePoint.Administration namespace