5

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:-

enter image description here

  • 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

2

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

  1. Download and install SharePoint Online SDK.

  2. Download the .ps1 file.

  3. Open the file (you can do it also in NotePad)

  4. 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

    1. Run the script in Powershell (any module).
    2. At the end you should receive a confirmation message like this:

enter image description here

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 .

enter image description here

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.

  • 1
    for your first comment I mention this for SharePoint enterprise to be full answer and useful for all , for the second point , make sure you open the master page at the root site, not the current site , for how to locate the sharepoint.dll files once you install SDK you will find it at this installation path c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll – Mohamed El-Qassas MVP Nov 11 '16 at 18:38
  • 1
    note @johnG , to make it clear in your case you should follow first steps for SharePoint online , but as I told you I mentioned for both versions to be useful for you and others because this error also appears in SharePoint enterprise , please don't hesitate to tell me if you need any clarification – Mohamed El-Qassas MVP Nov 11 '16 at 18:49
  • 1
    see my brother , once you have installed SDK that means you can work with SharePoint online objects because the DLL now located in your PC , SDK not responsible to run .ps1 you will need to use windows PowerShell or SharePoint online PowerShell so try to run .ps1 with windows PowerShell if not working try to install SharePoint online management shell , this my proof technet.microsoft.com/en-us/library/fp161397.aspx to can use windows PowerShell with SharePoint online , but without SDK you can't reach – Mohamed El-Qassas MVP Nov 11 '16 at 20:35
  • 1
    Yes, my steps on Web application level , your steps on Site Collection level . By the way are you run the above code in Browser Consol to enable Customizing Master Pages and Page Layouts ? this is the last thing we stop in chat !!! – Mohamed El-Qassas MVP Nov 13 '16 at 7:16
  • 1
    In your case, it's SharePoint online, and my provided above JSOM code applies this option for site collection level , please don't confuse with my solution for SharePoint on-prem ! as i told you I mentioned it to be useful for all versions ? are you need to remove it to avoid confusion ! – Mohamed El-Qassas MVP Nov 13 '16 at 22:34
1

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:

  1. You need to export seatle.html in your local drive.
  2. Rename the file to your need.
  3. Open Masterpage gallery in your site. Upload this HTML file.
  4. In order to convert the HTML page to Master Page navigate to Site Settings -> Look and Feel -> Design Manager. click on Edit Master Pages
  5. Click on link “Convert an HTML file to a SharePoint Master page”.
  6. Select the HTML file from masterpage gallery.
  7. Now you will be able to see your HTML in the list.
  8. Click the ellipses and publish the page.

You will now be able to edit the masterpage using the designer.

  • but i do not have the Masterpage gallery link, as i did not activate the publishing infrastrucre feature – john Gu Nov 11 '16 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.