How do I set DenyAddAndCustomizePages for SharePoint 2019 communication site

Copper Contributor

Hello,

 

I've set up a fresh new instance of SharePoint 2019, I've set up a communication site in Dev environment and wanted to save this site as a template, unfortunatly the option is not available and I get an "access denied" when accessing to the page thanks to the url.

 

Anyonye know if the same option can be applied as we can you in SharePoint Online:

set-sposite https://tenant.sharepoint.com/sites/communication -denyaddandcustomizepages $false

 

Thanks by advance 

7 Replies
Hi, I would highly recommend that you don't do that. That feature was removed for a good reason as it causes issues in the long term.

An alternative is to use the PnP provisioning engine and extract a template from the site. This can be easily done with PnP PowerShell and is very well documented.

Hope this helps
Thanks for the quick answer I will test if this option is available for SharePoint 2019, save as template is available for Modern Team Site that's what is very concerning about this feature:/
i have not seen that feature in any group enabled modern sites in a long time. How did you create the SPO site you are seeing it in?

I ran into this issue during a migration to SP 2019, some features are not available until this is reset.  See this posted solution:  

From <http://blog.konffaaja.com/2018/11/sharepoint-2019-and-2019-denyaddandcustomizepages/>

 

$site = Get-SPSite -Identity "https://intranet.contoso.com"
$site.DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

 

 

This worked

The following Software are is used to connect to your SharePoint Online via Powershell:

 

Download and Install SharePoint Online Management Shell

https://www.microsoft.com/en-us/download/details.aspx?id=35588

 

While installation, and if you get an error "This application requires the following to be installed: - PowerShell 3.0"

Step 2: Open SharePoint Online Management Shell from your window search bar.

 

 

Step 3: Connect to your SharePoint Admin Portal

Type the following command to open connection: 

Connect-SPOService

 

 

Enter the Url for your SharePoint Admin Portal (not your site, not yet)

 

Url: https://your-domain-admin.sharepoint.com

Replace with your domain

 

 

Hit Enter

 

Sign in

It will ask you for username and password for the user who has permission to manage SharePoint from SharePoint Admin Center

 

Step 4: Enable Scripting Capabilities on your site.

 
First check the status of the site for DenyAddAndCustomizePages  Get-SPOsite https://your-domain.sharepoint.com/sites/modern-site | Select DenyAddAndCustomizePages

Type the following command that will enable scripting capabilities on your modern site and any other site:

 

Set-SPOsite https://your-domain.sharepoint.com/sites/modern-site -DenyAddAndCustomizePages 0

Replace with your domain

Replace with the path of your modern site

 

@Joel Rodrigues I know this is an old topic, but more information on what issues can be caused that would be very helpful.

Hi Aaron,

Just to be clear, I was referring to the classic way of savings sites as templates. A common case is that sites created using these templates may not receive updates from Microsoft due to the way the classic templates work