Forum Discussion
María José Pedreira
Apr 24, 2017Brass Contributor
Upload Pages using Powershell / PnP
I need to upload the same Page into the Pages library in several webs. In my example, I'm located in my root path (http://myhost/Pages) and the first 3 lines work ok. I get an error in my line 4,...
- Apr 24, 2017
What is the error that you get?
Have you tried using a web object rather than a web url?
Add-PnPFile -Path $filePath -Web $Web -Folder $folder
Also have you tried with the / in the web url?
In general I use Get-PnPWeb and Get-PnPSubWebs to get my web object before calling Add-@PnPFile and that seems to work.
Apr 24, 2017
What is the error that you get?
Have you tried using a web object rather than a web url?
Add-PnPFile -Path $filePath -Web $Web -Folder $folder
Also have you tried with the / in the web url?
In general I use Get-PnPWeb and Get-PnPSubWebs to get my web object before calling Add-@PnPFile and that seems to work.
- María José PedreiraApr 24, 2017Brass Contributor
Hi Pieter Veenstra, first of all, thank you for your fast response...
I've tried this code instead 4-5 lines and Pages upload ok. Thank you!!
foreach ($subweb in Get-PnPSubWebs ) { Add-PnPFile -Path $file -Folder "/Pages" -Web $subweb
}