How to Delete a List View using PowerShell in SharePoint Online

Prerequisites:

SharePoint Online Management Shell: https://www.microsoft.com/en-us/download/details.aspx?id=35588

PnP – PowerShell Cmdlets: https://github.com/officedev/pnp-powershell/releases

PowerShell Script:

Open SharePoint Online Management Shell and execute the following script.

  1. ## Connects to a SharePoint Site  
  2. Connect-SPOnline -Url https://c986.sharepoint.com -Credentials (Get-Credential)  
  3.   
  4. ## Deletes a view from a list  
  5. Remove-SPOView -List /CustomDocLibrary -Identity "Demo View1"  
  6.   
  7. Remove-SPOView -List /CustomDocLibrary -Identity  17ebb7d0-d757-47a3-a49b-7bdea664dc89  
  8.   
  9. ##Disconnects the context  
  10. Disconnect-SPOnline