SPWeb.Delete method
刪除網站。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Sub Delete
'用途
Dim instance As SPWeb
instance.Delete()
public void Delete()
Exceptions
Exception | Condition |
---|---|
SPException | 刪除網站是根網站。 |
備註
若要刪除網站集合,請使用Delete方法。
Examples
下列程式碼範例會刪除指定的網站。
Using siteCollection As New SPSite("https://localhost")
Dim webSite As SPWeb = siteCollection.AllWebs("DeleteWebSite")
webSite.Delete()
End Using
using (SPSite oSiteCollection = new SPSite("http://Site_Name"))
{
SPWeb oWebsite = oSiteCollection.AllWebs["DeleteWebSite"];
oWebsite.Delete();
oWebsite.Dispose();
}
注意事項 |
---|
某些物件實作IDisposable介面,並且您必須避免之後不再需要保留這些物件在記憶體中。良好的程式碼撰寫方式的相關資訊,請參閱Disposing Objects。 |