pnp:file for a publishing page with force checkout enabled in pages library results in error: The file is not checked out. You have to checkout the file before making changes.
This also happens, when the file got checked out before applying the template.
When a file is checked out before applying the template, the file should get updated
when applying a template, an error gets thrown which says, that I have to checkout the file before I can edit it, although the file got checked out before.
(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable)
3.14.1910.1
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
I can conform I have the same issue. The same provisioning template that I used for the SharePoint 2013 with version 3.4.1812.2 did not have this issue.
Edit: forcing checkout before applying the template does not work. After some further investigation I noticed that changes are applied correctly. So, applying template does work but unfortunately it errors causing the rest of my provisioning to halt. It seems it is the
The issue seems to be introduced in https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectFiles.cs in changeset https://github.com/SharePoint/PnP-Sites-Core/commit/45081b244d7c0c72665fec8e5f53cf8649a0eca3#diff-8517941d31ab58d99a9abbec2b3b42f7 . Here, modifying the properties of the file was moved after the section where the file is checked in. Thus causing the page to have a checkedin-status when the properties are modified, causing the error.
I solved the issue for now by reverting to the release of april 2019. This is the release before the change commited. @erwinvanhunen I am tagging you, since I have no knowledge at all of actually contributing to PnP. If more information is needed, I am happy to help.
Thank you very much:-)
I hope that the change will be merged soon so we can make use of this feature.
Just to report the same issue using the PnP PowerShell for SharePoint Online with templates for classic sites types.
It works until the version 3.13.1909.0. _Since version 3.14.1910.0 to 3.16.1912.0 is giving the same error_
Microsoft.SharePoint.Client.ServerException: The file "https://tenant.sharepoint.com/sites/classicteamsite/Pages/Home.aspx" is not checked out. You must first check out this document before making changes.
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser)
at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation)
at SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate.ExecuteCmdlet()
at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()
with this information it should be possible to check the checkins / see the diffs between the version 3.13.1909.0 and 3.14.1910.0...
I will try to have a look when I am back from holyday.... maybe it is easy to find out what went wrong in the checkins or where the bug could come from.
Most helpful comment
Just to report the same issue using the PnP PowerShell for SharePoint Online with templates for classic sites types.
It works until the version 3.13.1909.0. _Since version 3.14.1910.0 to 3.16.1912.0 is giving the same error_