Template provisioning - Extract site or page-for-page for efficiency? #1285
|
Hello! I'm building a SP provisioning engine, or basically a SharePoint page copy function using the PnP.Framework provisioning templates. It works OK, but as I might have 1 or many SitePages to copy, would it be more or less effective to extract the whole site template and remove unused pages or just make template for each page as I go? Best regards |
Replies: 3 comments 1 reply
|
Not sure if I understood correctly but wouldn't it be better to export a basic tempalte of the site and then just export each page you plan ot move which will be attached then to the same template. You will end up with a single template having all the pages you wanted to move. or something close to that 🙂 |
|
C# is my poison of choice... Well yes, that is how I use it now, but when copying more than x pages I tend to see the message "Starting template engine" (or something) and i start to wonder... Current way of using it Ant the "extract whole site and remove unwanted pages" is something like: Best regards |
|
I would keep the shape Adam suggested: build one The reason is that var template = new ProvisioningTemplate();
var helper = new ClientSidePageContentsHelper();
foreach (var pageName in listOfWantedPages)
{
helper.ExtractClientSidePage(
sourceContext.Web,
template,
creationInfo,
scope,
pageUrl: null,
pageName,
isHomePage: false,
isTemplate: false);
}
// apply/provision this one template onceI would only use So the decision rule I would use:
If that answers the efficiency trade-off, please mark the discussion as answered. |
I would keep the shape Adam suggested: build one
ProvisioningTemplate, extract only the pages you need into that same template, then apply the template once.The reason is that
ClientSidePageContentsHelper.ExtractClientSidePage(...)takes the existingProvisioningTemplateas an argument and appends the extracted page intotemplate.ClientSidePages. So page-by-page extraction does not have to mean “one template engine run per page” or “one template per page”; it can be: