Delete Sub Site in SharePoint using CSOM

The example in this topic show how to use CSOM to Delete Sub Site in SharePoint

  • using Microsoft.SharePoint.Client;
  • using (ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection"))
  • {
  • // Make sure the site you are deleting is no longer in use.
  • // Once a site is deleted, there's no way you can recover the site.
  • clientContext.Web.DeleteObject();
  • clientContext.ExecuteQuery();
  • }

Thank you for reading this article. This code was tested in SharePoint 2013

We value your feedback:

Page URL:







© 2019 Code SharePoint