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)
Syntax
'Declaration
Public Sub ForceDeleteSite ( _
siteId As Guid, _
gradualDelete As Boolean, _
restorable As Boolean _
)
'Usage
Dim instance As SPContentDatabase
Dim siteId As Guid
Dim gradualDelete As Boolean
Dim restorable As Boolean
instance.ForceDeleteSite(siteId, gradualDelete, _
restorable)
public void ForceDeleteSite(
Guid siteId,
bool gradualDelete,
bool restorable
)
Parameters
siteId
Type: System.GuidThe GUID of the site collection that is deleted.
gradualDelete
Type: System.Booleantrue to use gradual deletion (see Remarks), false to delete immediately.
restorable
Type: System.Booleantrue 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.
Exceptions
Exception | Condition |
---|---|
NotSupportedException | 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. |
Remarks
Warning
This method should only be used when SPSite.Delete fails because the SPSite object was incompletely deleted or is otherwise corrupt.
Important
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.