Export (0) Print
Expand All

SPSite.Delete method

Deletes the site collection from the server.

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

public void Delete()

The following code example illustrates how to use the Delete method.

SPSite oSiteCollection = new SPSite("http://" + 
    System.Environment.MachineName + "/sites/Site_Collection");

oSiteCollection.Delete();
oSiteCollection.Dispose();
NoteNote

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

Show:
© 2014 Microsoft