Can't rename a master page or edit using SharePoint designer 2013, although I have create it
Question
I am working on a SharePoint online Team site collection. now the team site have the publishing infrastructure features disabled. Now i want to create a custom master page for my site collection. and since i have the publishing infrastructure site collection feature is disabled, so i can NOT upload a new master page using the UI (Site setting>>Look and Feel>>Master page), so i decide to create the new master page using sharepoint designer.
To do so I did the following steps:-
- I login using an admin account (have full permission)
- Using SharePoint designer 2013 I copy the
seatle.master
. - Paste it.
- Where a new master page named
seatle_copy(1).master
- Now I tried to edit it using SharePoint designer , but I got this error:-
- Also when I try rename it , I will get this error:-
Server Error : Access Denied
So I am not sure why I have the ability to create a new master page , but I can not edit, rename, check-out, check-in ,etc...
Thanks
La solution
This issue occurs if this option Customizing Master Pages and Page Layouts
is disabled !
To check the value of master page customization is allowed on the current site collection try to run the following code
function getMasterPageAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
var siteInfo = '';
//The below line get the boolean value of master page editing is allowed on this site collection
if (oSite.get_allowMasterPageEditing())
siteInfo = 'MasterPage customization: Allowed';
else
siteInfo = 'MasterPage customization: Not Allowed';
alert(siteInfo.toString());
}),
Function.createDelegate(this, function(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}));
}
function injectMethod() {
getMasterPageAccess();
}
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js");
Code Ref Get Master Page Customization in Browser console
If it's not allowed you can run this code in browser console
function enableMasterPageAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to enables the master page access
oSite.set_allowMasterPageEditing(true);
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
var siteInfo = '';
//The below line get the boolean value of master page editing is allowed on this site collection
if (oSite.get_allowMasterPageEditing())
siteInfo = 'MasterPage customization: Allowed';
else
siteInfo = 'MasterPage customization: Not Allowed';
alert(siteInfo.toString());
}),
Function.createDelegate(this, function(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}));
}
function injectMethod() {
enableMasterPageAccess();
}
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js");
Code Ref Enable / Disable Master Page Customization in Site Collection
Or use the following PowerShell Script
To enable Customizing Master Pages and Page Layouts
in SharePoint online by following the mentioned steps
Download and install SharePoint Online SDK.
Download the .ps1 file.
Open the file (you can do it also in NotePad)
Insert your data in these lines:
PowerShell
# Paths to SDK. Please verify location on your computer.
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
# Insert the credentials and the name of the admin site
$Username="admin@tenant.onmicrosoft.com"
$AdminPassword=Read-Host -Prompt "Password" -AsSecureString
$Url="https://tenant.sharepoint.com/sites/teamsitewithlibraries"
$setting=$true
- Find on your computer where SharePoint.Clitent.dll and SharePoint.Client.Runtime.dll libraries are located and insert the correct paths
- Instead of "admin@tenant.onmicrosoft.com" enter you username
- Instead of "https://tenant.sharepoint.com/sites/teamsitewithlibraries" enter the name of the site collection where you want to change the setting
If you want to ENABLE master page editing, skip the next line. If you want to DISABLE master page editing, change it to $false
- Run the script in Powershell (any module).
- At the end you should receive a confirmation message like this:
Ref for script Enable page editing when master page editing has been disabled for this site
Also, For SharePoint enterprise you can enable this option from the central administration > application management > select web application > general setting > SharePoint Designer > check Enable Customizing Master Pages and Layout Pages
.
Note: After you Enable Customizing Master Pages and Layout Pages
, if you tried to copy Seattle / Oslo Master Page , you should copy *.Html
file rather than the *.master
file.
Autres conseils
From the description you added, I can tell you the basic idea why it is happening to you. In SharePoint 2013, the direct masterpage changes are restricted.
Follow below steps to make your masterpage:
- You need to export
seatle.html
in your local drive. - Rename the file to your need.
- Open
Masterpage gallery
in your site. Upload this HTML file. - In order to convert the HTML page to Master Page navigate to
Site Settings -> Look and Feel -> Design Manager
. click on Edit Master Pages - Click on link “Convert an HTML file to a SharePoint Master page”.
- Select the HTML file from masterpage gallery.
- Now you will be able to see your HTML in the list.
- Click the ellipses and publish the page.
You will now be able to edit the masterpage using the designer.