Fix for Edit Page Options Missing in SP 2019(on premises) for Basic Search Sub Site Template

Background – Recently, I was working on for On-Premises project to configure a mini search center for some of the site collections within a web application. The idea here was to create a subsite with a Basic search as a template for each site collection. After creating a subsite for search, I was supposed to configure the OOTB results page to set a particular Result Source, modify the refinement panel web part to add custom refiners, etc. So to do this what we were supposed to do is go to the search site results page which would be at url /sites/alliance/search/results.aspx and edit this page so that I can configure the web parts.

Issue – Edit Page option was missing in gear icon for both default and results.aspx page. Without this, there is no way I can configure these webparts.

Analysis

  • I was site collection administrator so I have proper privileges.
  • Still, my inner feeling asked me to check permission for this user and I got below it says full control via some group but it also said says “Deny – Add and Customize Pages”

  • So I tried to google about this permission deny and found so many articles for SharePoint online where it was suggested to enable custom script from SharePoint Admin center.
  • And many suggested enabling using below script but all of this solution for SharePoint online.
Connect-SPOService <Adminurl>
Set-SPOSite -Identity https://.sharepoint.com/sites/alliance -DenyAddAndCustomizePages $false
  • Still, I thought of trying this out for On-Premises using PnP Powershell for SP 2019, I was able to connect to site etc but the site or web object doesn’t have this property “DenyAddAndCustomizePages” .  It will throw an error saying these properties not found and also intelligence also did not had suggest this property. There were some other properties like AllowMasterPageEditing, AllowDesigner, etc… Tried to enable both this property but still not luck.
  • So I was keen to find the solution and asked for help with community friends and that is when my dear friend @SanganiKunj sent me one link for On-Premises.
  • It has a similar solution as above but in a different syntax, tried a similar thing using PnP Powershell but the same error of property not found.

Resolution 

  • Login to SP 2019 Farm Server(actual WFE server)
  • Open SP 2019 management shell as administrator
  • Execute below command
(Get-SPSite -Identity "https://my-domain/sites/alliance").DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

Note – For me above command did not run on a single try, as soon as I ran I got an access denied error. In my case, I had used different FarmAdminAccount to login to Server and SharePoint Management Shell was also running under this account. And though being a FarmAdminAccount this account was not site collection admin on a targeted site collection, So I had to add this farm admin account to site collection as administrator and then the command ran successfully.

  • Now when I went back to check the user permission for my account it did not show the exception of “Deny – Add and Customize Pages”.
  • Went straight to Search subsite and clicked on the gear icon and wolla, edit page option was visible 🙂

Other Resolutions I tried but which did not work(to save you time)

  • Enabling publishing feature on-site collection and subsite(search in my case)
  • From central administration – went to web application web part security settings and checked if custom scriptable web parts are enabled or not, it was enabled.

Hope this helps….. Happy coding..!!!!

(Visited 1,427 times, 1 visits today)