Today, we’ll look at deleting a SharePoint List in Office 365 using PowerShell PnP.
For more info about the Practices & Patterns (PnP), refer to the official documentation, and/or download the modules from the hard workers in GitHub – SharePoint PowerShell PnP.
First we need to connect the SharePoint Online site using the below command,
Step 1
Open SharePoint Management Shell as an Administrator in your machine.
Step 2
Run the following command to import PnP to install the PowerShell cmdlets,
  1. Install-Module SharePointPnPPowerShellOnline
Step 3
To use the library you first need to connect to your tenant using the below cmdlets.
  1. connect-PnPOnline –Url https://fortunestrikes.sharepoint.com –Credentials (Get-Credential)
Syntax - https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/remove-pnplist?view=sharepoint-ps
  1. Remove-PnPList
  2. -Identity <ListPipeBind>
  3. [-Recycle [<SwitchParameter>]]
  4. [-Force [<SwitchParameter>]]
  5. [-Web <WebPipeBind>]
  6. [-Connection <PnPConnection>]
Syntax - Remove List item
  1. Remove-PnPListItem
  2. -List <ListPipeBind>
  3. -Identity <ListItemPipeBind>
  4. [-Recycle [<SwitchParameter>]]
  5. [-Force [<SwitchParameter>]]
  6. [-Web <WebPipeBind>]
  7. [-Connection <PnPConnection>]
Now that we’re logged into the site collection, let’s create our List/document library.
Remove List/ document library
  1. Remove-PnPList -Identity DemoList
Remove-PnPListItem
  1. Remove-PnPListItem -List "Demo List" -Identity "5" -Force
Thanks for reading my blog.