With SharePoint Online you can get template from site collection with

ProvisioningTemplateCreationInformation ptci = new ProvisioningTemplateCreationInformation(ctx.Web);
// Create FileSystemConnector to store a temporary copy of the template 
ptci.FileConnector = new FileSystemConnector(tempFolderPath, "");
ptci.PersistComposedLookFiles = true;
ptci.ProgressDelegate = delegate (String message, Int32 progress, Int32 total)
    // output progress to log
    Console.WriteLine($"{progress:00}/{total:00} - {message}");

// Execute actual extraction of the template
ProvisioningTemplate template = ctx.Web.GetProvisioningTemplate(ptci);

but how would I get all pages from that site collection and save them to that template? (so I could create a new site collection with same content for testing purposes)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.