Steps
- Open SharePoint Management Shell
- Copy the code given below and run it.
- Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
- Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
-
- $siteUrl = “https:
- $username = "[email protected]"
- $password = ""
- $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
- $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
- $ctx.Credentials = $credentials
-
- $web = $ctx.Web
-
- $ctx.Load($web)
- $ctx.ExecuteQuery()
-
- $web.DeleteObject()
- $ctx.ExecuteQuery()
- Write-Host $web.Title "Site collection has been deleted"
Thanks for reading my blog.