Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Delete A SharePoint Online/O365 Site Using PowerShell And CSOM
WhatsApp
Gowtham Rajamanickam
8y
5.4
k
0
0
25
Blog
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:
//gowtham.sharepoint.com/tutorials/sitecollections/test1”
$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.
Sharepoint
Powershell
Up Next
Creating the Site Columns/Fields Using CSOM in PowerShell in Office 365 / SharePoint Online
Ebook Download
View all
SharePoint Framework (SPFx) A Developers Guide
Read by 11.1k people
Download Now!
Learn
View all
Membership not found