Forum Discussion
María José Pedreira
Apr 26, 2017Brass Contributor
Upload Published Files using Add-PnPFile
Hi all,
I have to upload a file and next command works fine:
Add-PnPFile -Path $file -Folder "/Pages" -Web $subweb -Values @{Title=$subweb.Title}
After upload the file, I get information about the file state. The file is checked out for me.
I try to use next command to publish it (using -Publish flag), but I get a message telling that the file is checked out and then it can't be published
Add-PnPFile -Path $file -Folder "/Pages" -Web $subweb -Values @{Title=$subweb.Title} -Publish
I dont see any flag related with CheckIn File action ¿How I can to upload a file with state Published?
Thank you!
- María José PedreiraBrass Contributor
Hi Pieter,
using:
Set-PnPFileCheckedIn -Web $subweb -Url "/Pages/myPage.aspx" -CheckinType MajorCheckin -Comment "Version1.0"
I get the error:
Set-PnPFileCheckedIn : Value does not fall within the expected range.I'm quite sure that the Url expects a server relative Url
-Url /sites/site/subweb/Pages/default.aspx