How to delete a SharePoint list online using Powershell ?

Hello Sharepointers,

In this blog, we will see sharepoint online CSOM powershell commands to delete a list in office 365 or sharepoint online environment.

$site = ‘https://mysite.sharepoint.com/’
$admin = ‘Admin@myoffice365.OnMicrosoft.Com’
#Get Password as secure String
$password =””
$context = New-Object Microsoft.SharePoint.Client.ClientContext($site)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($admin , $password)
$context.Credentials = $credentials
$list = $context.Web.Lists.GetByTitle(‘mycustomlist’)
$context.Load($list)
$list.DeleteObject()
$list.Update()

Happy SharePointing folks!!

Leave a Reply

Your email address will not be published. Required fields are marked *