Open ThreadPitt opened 7 years ago
@ThreadPitt This bug has already been reported in summer 2016: https://github.com/SharePoint/PnP-Sites-Core/issues/663 I even suggested a fix several months ago without getting any reaction, so don't expect this to be fixed anytime soon in the provisioning framework. The basic problem is, that the attributes of an empty composed look are blank ("") in the object instance but the code expects them to be null when empty. Meanwhile you can work around the bug if you set them to null by yourself, e.g.
if (template.ComposedLook.Name == "")
template.ComposedLook.Name = null;
if (template.ComposedLook.ColorFile == "")
template.ComposedLook.ColorFile = null;
if (template.ComposedLook.FontFile == "")
template.ComposedLook.FontFile = null;
if (template.ComposedLook.BackgroundFile == "")
template.ComposedLook.BackgroundFile = null;
You could do that before saving the Xml or before applying the template (or both, to be sure). HTH Christian
Thanks, I tried that again today and now I get:
BUT: The test.spcolor file is not included in the .pnp. I double-checked that I have ptci.PersistBrandingFiles = true
Did you add a FileConnector to the ProvisioningTemplateCreationInformation? Afaik this is needed to store the branding files.
Yes I did, the pnp file is created, even the site logo is included in the pnp file. I openend another issue for that: #1440
I get this error aswell with PnP Powershell. It seems to happen when using All handlers. I guess one of the handlers is causing this problem.
I dont get the error when specifying the following handlers: $provisioningTemplate = Get-PnPProvisioningTemplate -Out $aTemplateFileLocation -Handlers Features,Fields,Files,Lists,Pages,Publishing,RegionalSettings,SearchSettings,TermGroups,SiteSecurity,ContentTypes,PropertyBagEntries,PageContents,WebSettings,Navigation -PersistBrandingFiles -ErrorAction SilentlyContinue -ErrorVariable errorProvision;
The bug is in the "ComposedLook" handler. As long as you don't use that you won't run into this error.
Category
[x ] Bug [ ] Enhancement
Environment
[ ] Office 365 / SharePoint Online [x ] SharePoint 2016 [ ] SharePoint 2013
If SharePoint on-premises, what's exact CU version: August 2017 CU (sts2016-kb4011049-fullfile-x64-glb) SharePointPnPCore2016: version="2.17.1708.1" targetFramework="net452"
Expected or Desired Behavior
ApplyProvisioningTemplate() works with Custom Composed Look
Observed Behavior
ApplyProvisioningTemplate() with a Custom Composed Look throws
Value cannot be null.Parameter name: masterPageServerRelativeUrl
at Microsoft.SharePoint.Client.BrandingExtensions.SetMasterPageByUrl(Web web, String masterPageServerRelativeUrl, Boolean resetSubsitesToInherit, Boolean updateRootOnly) at Microsoft.SharePoint.Client.BrandingExtensions.SetComposedLookByUrl(Web web, String lookName, String paletteServerRelativeUrl, String fontServerRelativeUrl, String backgroundServerRelativeUrl, String masterServerRelativeUrl, Boolean resetSubsitesToInherit, Boolean updateRootOnly) at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectComposedLook.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo) at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation) at ProvisioningConsole.Program.ApplyProvisioningTemplate(ConsoleColor defaultForeground, String webUrl, String userName, SecureString pwd, ProvisioningTemplate template) in D:\Dev\ProvisioningConsole\ProvisioningConsole\Program.cs:line 104 at ProvisioningConsole.Program.Main(String[] args) in D:\Dev\ProvisioningConsole\ProvisioningConsole\Program.cs:line 26 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
Steps to Reproduce
Notes:
Looking at the template, I see:
<pnp:ComposedLook Name="" ColorFile="" FontFile="" BackgroundFile="" Version="0" />