Using the SharePoint 2010 Managed Client Object Model – Delete a List
This is a clipboard friendly version of example #13, Delete a List, from Using the SharePoint 2010 Managed Client Object Model.
This blog is inactive.
New blog: EricWhite.com/blog
using System;
using Microsoft.SharePoint.Client;
class DisplayWebTitle
{
static void Main()
{
ClientContext clientContext =
new ClientContext("https://intranet.contoso.com");
clientContext.Web.Lists.GetByTitle("Client API Test List")
.DeleteObject();
clientContext.ExecuteQuery();
}
}
Following is the same example using fully qualified names for better discoverability.
using System;
class Program
{
static void Main()
{
Microsoft.SharePoint.Client.ClientContext clientContext =
new Microsoft.SharePoint.Client.ClientContext("https://intranet.contoso.com");
clientContext.Web.Lists.GetByTitle("Client API Test List")
.DeleteObject();
clientContext.ExecuteQuery();
}
}