Forum Discussion

Soheilsd's avatar
Soheilsd
Copper Contributor
Jul 29, 2019
Solved

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...
  • paulpascha's avatar
    Jul 29, 2019
    Just 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!

Resources