Admin.DeleteSite Method
Deletes the specified site collection.
Namespace: [Admin Web service]
Web service reference: http://Site/_vti_adm/Admin.asmx
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/DeleteSite", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub DeleteSite ( _
Url As String _
)
'Usage
Dim instance As Admin
Dim Url As String
instance.DeleteSite(Url)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/DeleteSite", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void DeleteSite(
string Url
)
Parameters
Url
Type: System.StringString that contains the absolute URL of the site collection to delete.
Remarks
The account that accesses this Web service must be a member of the Farm Administrators group in the Central Administration site. By default, the server's local Administrators group is in the Farm Administrators group.
To access the Admin service and its methods, set a Web reference to https://Server_Name:Port_Number/_vti_adm/Admin.asmx.
Note
This service is only available on the Central Administration Web application, and not on any of the content Web applications.
In Active Directory account creation mode, the DeleteSite method does not remove user accounts from the Active Directory directory service.
Examples
The following example deletes the specified site collection.
Dim admService As New Web_Reference_Folder_Name.Admin()
admService.Credentials = System.Net.CredentialCache.DefaultCredentials
Try
admService.DeleteSite("http://Server_Name/sites/SiteCollection_Name")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Web_Reference_Folder_Name.Admin admService =
new Web_Reference_Folder_Name.Admin();
admService.Credentials= System.Net.CredentialCache.DefaultCredentials;
try
{
admService.DeleteSite("http://Server_Name/sites/SiteCollection_Name");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}