From c73fc920e2fe1ced5104c979c2b332dd28361061 Mon Sep 17 00:00:00 2001 From: Carlos Date: Fri, 3 Jul 2020 13:44:10 +0200 Subject: [PATCH] Update ObjectFiles.cs Setting properties before checkin causes an error "The file is not checked out" when trying to set the webparts. ref issue: #1831 --- .../Provisioning/ObjectHandlers/ObjectFiles.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectFiles.cs b/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectFiles.cs index f2cc21d182..c6a4411a8c 100644 --- a/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectFiles.cs +++ b/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectFiles.cs @@ -182,13 +182,6 @@ public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate templ } #endif - //Set Properties before Checkin - if (file.Properties != null && file.Properties.Any()) - { - Dictionary transformedProperties = file.Properties.ToDictionary(property => property.Key, property => parser.ParseString(property.Value)); - SetFileProperties(targetFile, transformedProperties, parser, false); - } - switch (file.Level) { case Model.FileLevel.Published: @@ -218,6 +211,12 @@ public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate templ { targetFile.ListItemAllFields.SetSecurity(parser, file.Security); } + + if (file.Properties != null && file.Properties.Any()) + { + Dictionary transformedProperties = file.Properties.ToDictionary(property => property.Key, property => parser.ParseString(property.Value)); + SetFileProperties(targetFile, transformedProperties, parser, false); + } } web = originalWeb; // restore context in case files are provisioned to the master page gallery #1059 @@ -377,4 +376,4 @@ private static File UploadFile(Microsoft.SharePoint.Client.Folder folder, Stream return targetFile; } } -} \ No newline at end of file +}