The example in this topic shows how to Delete a List from SharePoint Using CSOM
Please follow the steps to execute the code in visual studio using Console Application
How to create the project
- Open your Visual Studio.
- From the template select Console Application as shown in the screenshot and click next.
- Enter name and select the location to store the project and click create as shown in the screenshot.
- Now your program. cs file will open, write/copy, paste the below-given code.
using System;
namespace CSOMCRUD
{
class Program
{
try
{
using (ClientContext clientContext = new ClientContext("Site URL"))
{
Web web = clientContext.Web;
// Get List by Title, Enter the list Name which you want to delete
List list = web.Lists.GetByTitle("Employee");
list.DeleteObject();
// Execute the query
clientContext.ExecuteQuery();
}
}
catch (Exception ex)
{
throw;
}
}
}
Thank You for reading. Hope you have enjoyed this! :-)



Comments
Post a Comment