Activate SharePoint Server Publishing Infrastructure on Modern

By default, when you trying to activate the SharePoint Server Publishing Infrastructure feature, you’re getting an error message on your SharePoint. That is because there are some hidden SharePoint features required to be able to acticate SharePoint Server Publishing Infrastructure. This option that are disabled with the SharePoint Modern Experience.

On the Reference section below is more information about the features that needed to be activated to activate successfully this feature. Some of these features are not available to be activated on the SharePoint Site Collection and because of that, we need to use PowerShell to activate those. Note this process will change your SharePoint site Structure.

The first step is to allow Custom Script on SharePoint Tenant:

  1. Go to your SharePoint Admin center change the URL to your tenant admin. https://contoso-admin.sharepoint.com
  2. If this opens the new SharePoint admin center, select Classic SharePoint admin center in the left pane.
  3. Select Settings.
  4. Under Custom Script choose:
    • Allow users to run custom script on personal sites.
    • Allow users to run custom script on self-service created sites.
  5. Select OK.

 Note: It can take up to 24 hours for the change to take effect.

The next step is to allow Custom Script on SharePoint Site Collection and for that, we need to use the next PowerShell:

Connect-SPOService -Url https://contoso-admin.sharepoint.com 
Set-SPOSite -Identity https://contoso.sharepoint.com/sites/Publishing -DenyAddAndCustomizePages 0

Finally, we need to connect to the SharePoint Site Collection to activate the features that are required to have the SharePoint Server Publishing Infrastructure activated.

Connect-PnPOnline -url https://contoso.sharepoint.com/sites/Publishing 

Enable-PnPFeature -Identity dffaae84-60ee-413a-9600-1cf431cf0560 -force #RollupPages 
Enable-PnPFeature -Identity 22a9ef51-737b-4ff2-9346-694633fe4416 -force #Publishing
Enable-PnPFeature -Identity f6924d36-2fa8-4f0b-b16d-06b7250180fa -force -Scope site #SharePoint Server Publishing Infrastructure of Site Collection
Enable-PnPFeature -Identity 94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb -force -Scope web #SharePoint Server Publishing Infrastructure of Site 

Conclusion

When all these processes are concluded, you’ll have the SharePoint Server Publishing Infrastructure activated on your Modern Site and start to take the advantages of these older functionalities On the article in the references section, you can find more information about those functionalities.

If you intend to revert back this process, you need to Deactivate the features in the following order:

Connect-PnPOnline -url https://contoso.sharepoint.com/sites/Publishing 

Disable-PnPFeature -Identity 94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb -force -Scope web #SharePoint Server Publishing Infrastructure of Site
Disable-PnPFeature -Identity f6924d36-2fa8-4f0b-b16d-06b7250180fa -force -Scope site #SharePoint Server Publishing Infrastructure of Site Collection

References

2 Comments

  1. Ben said:

    Hi David,
    Great read, do you know how to enable for Communications sites for SharePoint 2019 on prem?

    Thank you.

    September 16, 2019
    Reply
    • David Ramalho said:

      Hi Ben,

      The features that required to be activated are the same, but the way to activate the custom scripts are a bit different. Please review this article and follow the instruction – https://support.bindtuning.com/hc/en-us/articles/360030872511

      Let me know if that worked and thanks for the comment.

      My best,
      David Ramalho

      September 17, 2019
      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *