SPWeb.Delete 方法

Deletes the website.

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public Sub Delete
用法
Dim instance As SPWeb

instance.Delete()
public void Delete()

异常

异常 条件
SPException

The deleting website is a root website.

备注

To delete a site collection, use the Delete method.

示例

The following code example deletes a specified website.

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();
}

备注

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.

另请参阅

引用

SPWeb 类

SPWeb 成员

Microsoft.SharePoint 命名空间