locked
SharePoint Server 2019 - Which is the right script to enable "_layouts/savetmpl.aspx" page in modern site ? RRS feed

  • Question

  • Hello,

    I am checking out enabling save site as tempalte option for modern site, however I have some confusion as follows:

    Which script is correct to enable "save site as tempalte" option in followings?

    Script 1
    $site = Get-SPSite -Identity "https://mysite"
    $site.DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

    Script 2
    Add-Pssnapin "Microsoft.SharePoint.PowerShell"
    $web = Get-SPWeb "https://mysite"
    $web.AllProperties["SaveSiteAsTemplateEnabled"] = "true"
    $web.Update()

    Also, on which conditions "Save site as template" option will throw following error on modern team site ?

    Server Error in '/' Application.
    The "Save site as template" action is not supported on this site.

    Please suggest!

    Best Regards,


    Dipti Chhatrapati

    Thursday, August 1, 2019 10:26 AM

Answers

  • Script 2 is the correct script. but i am not sure about the below error on what based you got it. Try your second script that will work for you.

    Thanks & Regards,


    sharath aluri

    Thursday, August 1, 2019 11:02 AM
  • Hi Dipti,

    I believe " save as template " option no more support in Modern site. 

    https://support.office.com/en-us/article/create-and-use-site-templates-60371b0f-00e0-4c49-a844-34759ebdd989

    _______________________ 


    Thivagar SEGAR
    [If this Post helps you, then please don't forget to mark it answer or Vote for this post]

    No, We can save the modern site (modern team site and communication site) as the site template by visiting /_layouts/savetmpl.aspx page.

    When you access /_layouts/savetmpl.aspx , access denied may occur. It occurs because the denyaddandcustomizepages of this site is true. DenyAddAndCustomizePages determines whether the Add And Customize Pages right is denied on the site collection. By default, the right is denied on the modern site collection.

    $site = Get-SPSite -Identity "https://mysite"
    $site.DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMaskThanks & Regards,


    sharath aluri


    Thursday, August 1, 2019 11:23 AM

All replies

  • Script 2 is the correct script. but i am not sure about the below error on what based you got it. Try your second script that will work for you.

    Thanks & Regards,


    sharath aluri

    Thursday, August 1, 2019 11:02 AM
  • Hi Dipti,

    I believe " save as template " option no more support in Modern site. 

    https://support.office.com/en-us/article/create-and-use-site-templates-60371b0f-00e0-4c49-a844-34759ebdd989

    _______________________ 


    Thivagar SEGAR
    [If this Post helps you, then please don't forget to mark it answer or Vote for this post]

    Thursday, August 1, 2019 11:13 AM
  • Hi Dipti,

    I believe " save as template " option no more support in Modern site. 

    https://support.office.com/en-us/article/create-and-use-site-templates-60371b0f-00e0-4c49-a844-34759ebdd989

    _______________________ 


    Thivagar SEGAR
    [If this Post helps you, then please don't forget to mark it answer or Vote for this post]

    No, We can save the modern site (modern team site and communication site) as the site template by visiting /_layouts/savetmpl.aspx page.

    When you access /_layouts/savetmpl.aspx , access denied may occur. It occurs because the denyaddandcustomizepages of this site is true. DenyAddAndCustomizePages determines whether the Add And Customize Pages right is denied on the site collection. By default, the right is denied on the modern site collection.

    $site = Get-SPSite -Identity "https://mysite"
    $site.DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMaskThanks & Regards,


    sharath aluri


    Thursday, August 1, 2019 11:23 AM
  • Hi Sharath,

    Thank you for your response, if that is the case - then in my question, script 2 will work for me OR - I need to run both the scripts ?

    Best Regards,


    Dipti Chhatrapati

    Thursday, August 1, 2019 11:43 AM
  • That depends if you got the access denied error then you may have to run the first script or else second would be enough.

    Thanks & Regards,


    sharath aluri

    Thursday, August 1, 2019 11:58 AM