Forum Discussion
SAURAV KUMAR
Mar 12, 2022Copper Contributor
Need to remove one drive folder using PnP Powershell
Hi Team,
I'm trying to remove a folder using PnP and its throwing error as 404 Not Found, commands i am using as below
Connect-PnPOnline -Url "onedrive Url" - credential (Get-Credential)
$name = "Nest1"
$Folderpath = "Document\Nest1"
Remove-PnPFolder -Name $name -Folder $Folderpath - Force -Recycle
Thank you for your help
Regards
Saurav
I'm trying to remove a folder using PnP and its throwing error as 404 Not Found, commands i am using as below
Connect-PnPOnline -Url "onedrive Url" - credential (Get-Credential)
$name = "Nest1"
$Folderpath = "Document\Nest1"
Remove-PnPFolder -Name $name -Folder $Folderpath - Force -Recycle
Thank you for your help
Regards
Saurav
- SvenSieverdingBronze ContributorAre you trying to delete the folder "Document\Nest1" or "Document\Nest1\Nest1"?
This Powershell script tries to delete "Document\Nest1\Nest1"....
If you want to delete "Document\Nest1" then try
Remove-PnPFolder -Name "Nest1" -Folder "Document" - Force -Recycle- pk_TechCopper ContributorHi ,
I have run same command but getting the error message
Remove-PnPFolder -Name "lab_November" -Folder "Document" -Force -Recycle
Error Message: Remove-PnPFolder : The remote server returned an error: (403) Forbidden.