1

I have a SharePoint Online site that has custom scripts enabled, and I want to programmatically save it as a template. I do not want to use PnP Provisioning Templates, I want to access the same functionality as savetmpl.aspx but programmatically. I know that in SharePoint Server you can use the SPWeb.SaveAsTemplate method in PowerShell or C#, but this is not present in SharePoint Online. Is there a way to do this?

I also found the following url: https://mytenant-admin.sharepoint.com/_vti_bin/sites.asmx. I see ExportWeb listed there. Would this work in SharePoint Online?

I looked at this question, but I do not want to use PnP Provisioning

5
  • Just curious, why don't you want to use PnP Provisioning? It's safer, better supported, and more advanced than site templates ever were. But, I'm sure you have your reasons and I am interested in hearing them. Jul 6, 2020 at 21:07
  • I want to back up many sites, but I don't want the regular users who use these sites to have to go through me or connect to powershell on their own in order to activate these backups, especialy when they are already familiar with templates and the solution gallery.
    – spDevAdmin
    Jul 7, 2020 at 3:08
  • Thanks for the insight! PnP Provisioning is not a good backup service so that makes sense. It's great for templates though. I don't think you'll have much luck with Site Templates though as these are not supported for publishing sites (classic) or modern sites in SP Online. Jul 7, 2020 at 13:29
  • They are not supported, but you can set DenyAddAndCustomizePages to 0 using PowerShell and then saving a site as template will be enabled.
    – spDevAdmin
    Jul 7, 2020 at 13:53
  • Templates are not backups. You should be looking at a proper backup solution. And yes, you can bypass the restriction but it isn't supported for restoration.
    – user6024
    Aug 4, 2020 at 15:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.