How to delete List in Sharepoint 2013/Office 365 using CSOM

In this article, we will learn about List deletion in SharePoint 2013/Office 365 using CSOM. Below is the sample CSOM code to achieve the same.

ClientContext clientContext= new ClientContext(siteUrl);
clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
clientContext.Credentials = new SharePointOnlineCredentials(userName, pwd);
Web web = clientContext.Web;

List list = web.Lists.GetByTitle(“CutomList”);

list.DeleteObject();
clientContext.ExecuteQuery();

Hope it helps!! Happy Sharepointing 🙂

Leave a Reply

Your email address will not be published.