private void ExtractTemplate(string dirName, string fileName) { var outputTemplate = new ProvisioningTemplate(); var helper = new OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.Utilities.ClientSidePageContentsHelper(); var ci = new OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateCreationInformation(SelectedWeb); ci.PersistBrandingFiles = PersistBrandingFiles; if (!string.IsNullOrEmpty(dirName)) { var fileSystemConnector = new FileSystemConnector(dirName, ""); ci.FileConnector = fileSystemConnector; } helper.ExtractClientSidePage(SelectedWeb, outputTemplate, ci, new OfficeDevPnP.Core.Diagnostics.PnPMonitoredScope(), null, Identity.Name, false); if (!string.IsNullOrEmpty(fileName)) { System.IO.File.WriteAllText(Path.Combine(dirName, fileName), outputTemplate.ToXML()); } else { WriteObject(outputTemplate.ToXML()); } }
private void ExtractTemplate(string dirName, string fileName, ExtractConfiguration configuration) { var outputTemplate = new ProvisioningTemplate(); outputTemplate.Id = Guid.NewGuid().ToString("N"); var helper = new OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.Utilities.ClientSidePageContentsHelper(); ProvisioningTemplateCreationInformation ci = null; if (configuration != null) { ci = configuration.ToCreationInformation(SelectedWeb); } else { ci = new ProvisioningTemplateCreationInformation(SelectedWeb); } if (MyInvocation.BoundParameters.ContainsKey(nameof(PersistBrandingFiles))) { ci.PersistBrandingFiles = PersistBrandingFiles; } if (!string.IsNullOrEmpty(dirName)) { var fileSystemConnector = new FileSystemConnector(dirName, ""); ci.FileConnector = fileSystemConnector; } helper.ExtractClientSidePage(SelectedWeb, outputTemplate, ci, new OfficeDevPnP.Core.Diagnostics.PnPMonitoredScope(), null, Identity.Name, false); if (!string.IsNullOrEmpty(fileName)) { System.IO.File.WriteAllText(Path.Combine(dirName, fileName), outputTemplate.ToXML()); } else { WriteObject(outputTemplate.ToXML()); } }