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

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

Était-ce utile?

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

  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.

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:

  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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top