8,330 questions
How to use Add-PnPFolder to add a folder to other SPO Libraries

Callistus Lucien
0
Reputation points
I can use Add-PnPFolder to add a folder to the Shared Documents library but receives the follow error message "Add-PnPFolder : File Not Found." when attempting to add a folder to any other document library.
I have a csv file with a list of libraries that I want to add a specific folder to:
ForEach($row in $csv)
{
Write-Host -f Yellow "Adding" $row.Folder "to" $row.Library
# Add-PnPFolder -Name $row.Folder -Folder $row.Library
}
Error:
Add-PnPFolder : File Not Found.
At line:1 char:9
-
Add-PnPFolder -Name $row.Library -Folder $row.Folder
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [Add-PnPFolder], PSInvalidOperationException
- FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Files.AddFolder
Works just fine!! No errors.
ForEach($row in $csv)
{
Write-Host -f Yellow "Adding" $row.Folder "to" $row.Library
Add-PnPFolder -Name $row.Folder -Folder "Shared Documents"
}
Windows for business Windows Server User experience PowerShell
Sign in to answer