Today, we’ll look at deleting a SharePoint List in Office 365 using 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,
- Install-Module SharePointPnPPowerShellOnline
Step 3
To use the library you first need to connect to your tenant using the below cmdlets.
- connect-PnPOnline –Url https:
Syntax - https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/remove-pnplist?view=sharepoint-ps
- Remove-PnPList
- -Identity <ListPipeBind>
- [-Recycle [<SwitchParameter>]]
- [-Force [<SwitchParameter>]]
- [-Web <WebPipeBind>]
- [-Connection <PnPConnection>]
Syntax - Remove List item
- Remove-PnPListItem
- -List <ListPipeBind>
- -Identity <ListItemPipeBind>
- [-Recycle [<SwitchParameter>]]
- [-Force [<SwitchParameter>]]
- [-Web <WebPipeBind>]
- [-Connection <PnPConnection>]
Now that we’re logged into the site collection, let’s create our List/document library.
Remove List/ document library
- Remove-PnPList -Identity DemoList
Remove-PnPListItem
- Remove-PnPListItem -List "Demo List" -Identity "5" -Force
Thanks for reading my blog.