diff --git a/documentation/Export-PnPPage.md b/documentation/Export-PnPPage.md index 37ff5cab1..3bd629b7f 100644 --- a/documentation/Export-PnPPage.md +++ b/documentation/Export-PnPPage.md @@ -16,7 +16,7 @@ Exports a Client Side Page to a PnP Provisioning Template ```powershell Export-PnPPage [-Identity] [-PersistBrandingFiles] [-Out ] [-Force] - [-Configuration ] [-Connection ] + [-Configuration ] [-OutputInstance] [-Connection ] ``` @@ -141,15 +141,12 @@ Accept pipeline input: False Accept wildcard characters: False ``` - - -### -WhatIf -Shows what would happen if the cmdlet runs. The cmdlet is not run. +### -OutputInstance +Returns the template as an in-memory object, which is an instance of the SiteTemplate type of the PnP Core Component. It cannot be used together with the -Out parameter. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: wi Required: False Position: Named diff --git a/src/Commands/Pages/ExportPage.cs b/src/Commands/Pages/ExportPage.cs index 4c6236de0..228e06e57 100644 --- a/src/Commands/Pages/ExportPage.cs +++ b/src/Commands/Pages/ExportPage.cs @@ -29,6 +29,9 @@ public class ExportPage : PnPWebCmdlet [Parameter(Mandatory = false)] public ExtractConfigurationPipeBind Configuration; + [Parameter(Mandatory = false)] + public SwitchParameter OutputInstance; + protected override void ProcessRecord() { _ = Identity.GetPage(Connection) ?? throw new Exception($"Page '{Identity?.Name}' does not exist"); @@ -95,9 +98,15 @@ private void ExtractTemplate(string dirName, string fileName, ExtractConfigurati } else { - WriteObject(outputTemplate.ToXML()); + if (OutputInstance) + { + WriteObject(outputTemplate); + } + else + { + WriteObject(outputTemplate.ToXML()); + } } } } - } \ No newline at end of file