diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a57605e8..b70a0c86b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,9 +44,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Changed - `-IsFavoriteByDefault` parameter is now obsolete in `Add-PnPTeamsChannel` cmdlet due to deprecation by Microsoft Graph API. [#3712](https://github.com/pnp/powershell/pull/3712) +- `Get-PnPSiteTemplate` will now only contain `PersistPublishingFiles`, `IncludeNativePublishingFiles`, `IncludeTermGroupsSecurity`, `IncludeSearchConfiguration`, `SkipVersionCheck` and `PersistMultiLanguageResources` if these are provided with the cmdlet as switch parameters [#3715](https://github.com/pnp/powershell/pull/3715) ### Contributors +- Nils Andresen [nils-a] - Gautam Sheth [gautamdsheth] - Nishkalank Bezawada [NishkalankBezawada] - Konrad K. [wilecoyotegenius] diff --git a/src/Commands/Provisioning/Site/GetSiteTemplate.cs b/src/Commands/Provisioning/Site/GetSiteTemplate.cs index d3b6b1763..b099a8e57 100644 --- a/src/Commands/Provisioning/Site/GetSiteTemplate.cs +++ b/src/Commands/Provisioning/Site/GetSiteTemplate.cs @@ -213,14 +213,26 @@ private void ExtractTemplate(XMLPnPSchemaVersion schema, string path, string pac creationInformation.PersistBrandingFiles = PersistBrandingFiles; } #pragma warning restore 618 - creationInformation.PersistPublishingFiles = PersistPublishingFiles; - creationInformation.IncludeNativePublishingFiles = IncludeNativePublishingFiles; + if (ParameterSpecified(nameof(PersistPublishingFiles))) + { + creationInformation.PersistPublishingFiles = PersistPublishingFiles; + } + if (ParameterSpecified(nameof(IncludeNativePublishingFiles))) + { + creationInformation.IncludeNativePublishingFiles = IncludeNativePublishingFiles; + } if (ParameterSpecified(nameof(IncludeSiteGroups))) { creationInformation.IncludeSiteGroups = IncludeSiteGroups; } - creationInformation.IncludeTermGroupsSecurity = IncludeTermGroupsSecurity; - creationInformation.IncludeSearchConfiguration = IncludeSearchConfiguration; + if (ParameterSpecified(nameof(IncludeTermGroupsSecurity))) + { + creationInformation.IncludeTermGroupsSecurity = IncludeTermGroupsSecurity; + } + if (ParameterSpecified(nameof(IncludeSearchConfiguration))) + { + creationInformation.IncludeSearchConfiguration = IncludeSearchConfiguration; + } if (ParameterSpecified(nameof(IncludeHiddenLists))) { creationInformation.IncludeHiddenLists = IncludeHiddenLists; @@ -229,12 +241,18 @@ private void ExtractTemplate(XMLPnPSchemaVersion schema, string path, string pac { creationInformation.IncludeAllClientSidePages = IncludeAllPages; } - creationInformation.SkipVersionCheck = SkipVersionCheck; + if (ParameterSpecified(nameof(SkipVersionCheck))) + { + creationInformation.SkipVersionCheck = SkipVersionCheck; + } if (ParameterSpecified(nameof(ContentTypeGroups)) && ContentTypeGroups != null) { creationInformation.ContentTypeGroupsToInclude = ContentTypeGroups.ToList(); } - creationInformation.PersistMultiLanguageResources = PersistMultiLanguageResources; + if (ParameterSpecified(nameof(PersistMultiLanguageResources)) && ContentTypeGroups != null) + { + creationInformation.PersistMultiLanguageResources = PersistMultiLanguageResources; + } if (extension == ".pnp") { // if file is of pnp format, persist all files @@ -436,4 +454,4 @@ public static void SetTemplateMetadata(ProvisioningTemplate template, string tem } } } -} +} \ No newline at end of file