Steps
  1. Open SharePoint Management Shell
  2. Copy the code given below and run it.
  1. Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
  2. Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
  3. $siteUrl = “https://gowtham.sharepoint.com/tutorials/sitecollections/test1”
  4. $username = "[email protected]"
  5. $password = ""
  6. $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
  7. $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
  8. $ctx.Credentials = $credentials
  9. $web = $ctx.Web
  10. $ctx.Load($web)
  11. $ctx.ExecuteQuery()
  12. $web.DeleteObject()
  13. $ctx.ExecuteQuery()
  14. Write-Host $web.Title "Site collection has been deleted"
Thanks for reading my blog.