Forum Discussion
Soheilsd
Jul 29, 2019Copper Contributor
Save as template again!!!
I am wondering if I can save a team site on SharePoint online as a template in a simple way??!! not using the PnP provisioning its too complicated... or is there a complete example of pnp code that...
- Jul 29, 2019Just wondering, why do you consider the PnP provisioning to be too complicated? You are looking for a solution from a Developer's perspective. With the PnP NuGet packages installed in your project, "Save as template" is basically just 1 line of code (web.GetProvisioningTemplate). Applying a template to another site is also just 1 line of code (web.ApplyProvisioningTemplate).
A sample console application using the above techniques can be found here:
https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/provisioning-console-application-sample
For SharePoint Online modern sites you can make use of Site Designs and Site Scripts. You could combine these with PnP provisioning as well.
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview
Hope this helps!
Soheilsd
Aug 17, 2019Copper Contributor
Hi my code were just doing fine until it gets this error at the end of it in the "web.ApplyProvisioningTemplate(template, ptai);" section:
error code:
“The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.”
what should I do with that??!!
paulpascha
Aug 27, 2019Bronze Contributor
This is an error related to a Calculated Field in your template. As the error says it refers to a column that doesn't exist. You should check the name of your column and make sure it exists before your calculated field is created.
Does this make sense?
Does this make sense?