Apr 26 2017 12:04 AM - last edited on Nov 09 2023 11:09 AM by
Apr 26 2017 12:04 AM - last edited on Nov 09 2023 11:09 AM by
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!
Apr 26 2017 01:36 AM
Apr 26 2017 03:54 AM
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.
Apr 26 2017 04:40 AM
I'm quite sure that the Url expects a server relative Url
-Url /sites/site/subweb/Pages/default.aspx
Apr 26 2017 08:55 AM - edited Apr 26 2017 08:56 AM
After trying several posibilities eventually I got it with
Add-PnPPublishingPage -PageName 'MyCustomName'
-Web $subweb
-Title $subweb.Title
-PageTemplateName 'MyCustomLayout'
-Publish
Jul 10 2018 05:15 AM
Try the "-Checkout" property. For example:
Add-PnPFile -Path ".\dummyPage.aspx" -Folder "Pages" -Checkout:$true -Publish:$true -PublishComment "PnP provisioned page"