Lists.DeleteList Method (Lists)
Deletes the specified list.

Web Service: ListsWeb Reference: http://<Site>/_vti_bin/Lists.asmx
Syntax

Visual Basic (Declaration)
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/DeleteList", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Sub DeleteList ( _
    listName As String _
)
Visual Basic (Usage)
Dim instance As Lists
Dim listName As String

instance.DeleteList(listName)
C#
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/DeleteList", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public void DeleteList (
    string listName
)

Parameters

listName

A string that contains either the title or the GUID for the list.

Example

The following code example deletes a specified list from the current site.

Visual Basic
Dim listService As New Web_Reference_Folder.Lists()
listService.Credentials = System.Net.CredentialCache.DefaultCredentials

listService.DeleteList("List_Name")
C#
Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials= System.Net.CredentialCache.DefaultCredentials;

listService.DeleteList("List_Name");
See Also

Tags :


Page view tracker