Add-Type -Path "\Software\SharePoint 2013 Client Browser v1.7\Microsoft.SharePoint.Client.dll"
Add-Type -Path "\Software\SharePoint 2013 Client Browser v1.7\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = “https://yourcorp.sharepoint.com/sites/SPOTest2/Testite/”
$username = "abc@abc.com"
$password = Read-Host -Prompt "Enter password" -AsSecureString
$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 "----------------------------------------------------------------------------" -foregroundcolor Green
Write-Host $web.Title "Site Deleted"
Write-Host "----------------------------------------------------------------------------" -foregroundcolor Green
Comments
Post a Comment