[Fixed] Error – activate the SharePoint Server Publishing Infrastructure feature in SharePoint Online site

[Fixed] hidden error: Activate SharePoint Server Publishing Infrastructure feature in SharePoint Online site (Microsoft 365)

No comments

Loading

Activate SharePoint server publishing infrastructure feature – When I was trying to activate the “SharePoint Server Publishing Infrastructure” feature in the SharePoint online communication site, getting the error – “Sorry, something went wrong An unexpected error has occurred. Technical Details, Troubleshoot issues with Microsoft SharePoint Foundation.

Activate SharePoint server publishing infrastructure feature error

When we try to activate the SharePoint server publishing infrastructure feature, using the SharePoint manage feature page, we get an error.

Activate SharePoint Server Publishing Infrastructure in the communication site
Activate SharePoint Server Publishing Infrastructure in the communication site

The error message as below:

Sorry, something went wrong
An unexpected error has occurred.
Technical Details

Troubleshoot issues with Microsoft SharePoint Foundation.

Correlation ID: 04105b9f-f0c6-0000-3be6-10383379617d

Date and Time: mm/dd/yyyy 6:22:38 AM

After some investigations got to know it is a known issue or expected behavior in the SharePoint online communication site because the “SharePoint Server Publishing Infrastructure feature” is not available on the communication site. Nevertheless, this issue does not happen only with the SharePoint online communication site, it also happens with the modern team site. So, in this troubleshooting blog – I will share how to activate the “SharePoint Server Publishing Infrastructure feature” on the SharePoint Online site when we face this issue.

[Fixed] Error – activate the SharePoint Server Publishing Infrastructure feature in SharePoint Online site
Error – activate the SharePoint Server Publishing Infrastructure feature in the SharePoint Online site

Key Highlights: activate SharePoint server publishing infrastructure feature

  • What is the publishing feature in SharePoint?
  • What is the SharePoint server publishing infrastructure feature?
  • Does the SharePoint server publishing infrastructure feature allow in the SharePoint Online communication site?
  • How to activate the SharePoint server publishing infrastructure feature in SharePoint Online using the PnP PowerShell?

What is the SharePoint server publishing infrastructure feature?

SharePoint provides lots of in-built templates to create a site like a Team site, communication site, wiki site blog site, publishing site, etc. for each type of site has its own needs and scope in the business. If you want to create a public-facing site that mostly deals with the pages – then we go ahead to create the publishing site. However, if you are working with a team site or communication site, or any other types of sites and we need to have the publishing feature enabled, still we can have it by enabling the publishing feature in the SharePoint site collection and web level.

Technically, what does the publishing feature do in SharePoint?

SharePoint’s publishing infrastructure provides centralized libraries, content types, master pages, and page layouts and enables page scheduling and other publishing functionality for a site collection.

The publishing infrastructure can be enabled by activating features at both the site collection and site(web) level.

The two features are responsible for enabling publishing on a SharePoint site:

  • SharePoint Server Publishing Infrastructure feature – site collection scope
  • SharePoint Server Publishing – site or web scope

The first feature is the SharePoint Server Publishing Infrastructure feature that is activated at the site collection level. Once the “SharePoint server publishing infrastructure” feature is activated, then we need to activate the “SharePoint Server Publishing” feature at the site or web level.

What is the SharePoint Server Publishing feature in SharePoint?

By activating the “SharePoint Server Publishing” feature we can create a web page library as well as supporting libraries to create and publish pages based on page layouts.

Does the SharePoint server publishing infrastructure feature allow in the SharePoint Online communication site?

No, as per Microsoft the SharePoint server publishing infrastructure feature is disabled or hidden in the SharePoint Online communication site, which means technically it does not support the communication site. However, I personally not convinced – since the  “SharePoint server publishing infrastructure” feature does not support the communication site why this option is being shown on the site collection feature activation page – the “SharePoint server publishing infrastructure” feature should have been hidden, in the communication site.

Activate SharePoint Server Publishing Infrastructure feature in the communication site
Activate the SharePoint Server Publishing Infrastructure feature in the communication site

How to activate the SharePoint server publishing infrastructure feature in SharePoint Online using the PnP PowerShell?

Thanks, Microsoft for making our life easy by providing the PnP command, if we get an error while activating the “SharePoint server publishing infrastructure” feature in the SharePoint communication or team site, using the below PnP PowerShell script we can activate the “SharePoint server publishing infrastructure” feature in SharePoint Online

Activate publishing feature SharePoint online using PowerShell: Activate the SharePoint server publishing infrastructure feature in SharePoint Online using the PnP PowerShell

Using the below PnP PowerShell script we activate the publishing feature in SharePoint online:


#The below script is used to activate the SharePoint Server Publishing Infrastructure feature in SharePoint Online.
cls

$PSshell = Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorVariable err -ErrorAction SilentlyContinue
if($PSshell -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

$fileName = "Activate SharePoint Server Publishing feature in SPO"
#'yyyyMMddhhmm yyyyMMdd
$enddate = (Get-Date).tostring("yyyyMMddhhmmss")
#$filename = $enddate + '_VMReport.doc'
$logFileName = $fileName +"_"+ $enddate+"_Log.txt"
$invocation = (Get-Variable MyInvocation).Value
$directoryPath = Split-Path $invocation.MyCommand.Path

$directoryPathForLog=$directoryPath+"\"+"LogFiles"
if(!(Test-Path -path $directoryPathForLog))
{
New-Item -ItemType directory -Path $directoryPathForLog
#Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}
#$logPath = $directoryPath + "\" + $logFileName

$logPath = $directoryPathForLog + "\" + $logFileName

$isLogFileCreated = $False

function Write-Log([string]$logMsg)
{
if(!$isLogFileCreated){
Write-Host "Creating Log File..."
if(!(Test-Path -path $directoryPath))
{
Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}
else
{
$script:isLogFileCreated = $True
Write-Host "Log File ($logFileName) Created..."
[string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)
Add-Content -Path $logPath -Value $logMessage
}
}
else
{
[string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)
Add-Content -Path $logPath -Value $logMessage
}
}

########################Activate the SharePoint Server Publishing Infrastructure feature in the site collection level##############################

#Parameters area
$siteURL = "YourSPOSiteURL"
$featureID = "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" #Site collection level scoped publishing Feature ID
$userName = "YourSPOUserName"
$passWord = "YourSPOPassword"
#Parameters area - Ends

$encPassWord = convertto-securestring -String $passWord -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord

Try
{
Connect-PnPOnline -Url $SiteURL -Credentials $cred

#Getting the site collection level feature by ID
$feature = Get-PnPFeature -Scope Site -Identity $featureID

#Getting the feature status with the feature definationId
If($feature.DefinitionId -eq $null)
{
#SharePoint Server Publishing Infrastructure is being activated in the SPO site collection.
Write-host -f Yellow "SharePoint Server Publishing Infrastructure is being activated in: "$SiteURL
Enable-PnPFeature -Scope Site -Identity $featureID -Force

Write-host -f Green "The SharePoint Server Publishing Infrastructure feature has been successfully activated Successfully!"
}
else
{

Write-host -f Yellow "The SharePoint Server Publishing Infrastructure feature is already activated in the " $SiteURL
}

}
Catch
{

$ErrorMessage = $_.Exception.Message +"in activating the SharePoint Server Publishing Infrastructure feature!:"
Write-Host $ErrorMessage -BackgroundColor Red
Write-Log $ErrorMessage

}

########################Activate the SharePoint Server Publishing Infrastructure feature in the site collection level - Ends here ##############################

########################Activate the SharePoint Server Publishing Infrastructure feature in the web level#######################################################

#Parameters area
$siteURL = "YourSPOSiteURL"
$featureID = "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" #Web level scoped publishing Feature ID
$userName = "YourSPOUserName"
$passWord = "YourSPOPassword"
#Parameters area - Ends

$encPassWord = convertto-securestring -String $passWord -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord

Try
{
Connect-PnPOnline -Url $SiteURL -Credentials $cred

#Getting the site collection level feature by ID
$feature = Get-PnPFeature -Scope Web -Identity $featureID

#Getting the feature status with the feature definationId
If($feature.DefinitionId -eq $null)
{
#SharePoint Server Publishing Infrastructure is being activated in the SPO site collection.
Write-host -f Yellow "SharePoint Server Publishing Infrastructure is being activated in(web level): "$SiteURL

Enable-PnPFeature -Scope Web -Identity $featureID -Force

Write-host -f Green "The SharePoint Server Publishing Infrastructure feature has been successfully activated Successfully(Web level)!"
}
else
{

Write-host -f Yellow "The SharePoint Server Publishing Infrastructure feature is already activated in the(Web level) " $SiteURL
}

}
Catch
{

$ErrorMessage = $_.Exception.Message +"in activating the SharePoint Server Publishing Infrastructure feature(web level)!:"
Write-Host $ErrorMessage -BackgroundColor Red
Write-Log $ErrorMessage

}

########################Activate the SharePoint Server Publishing Infrastructure feature in the web level - ends here###########################################

Summary: Activate SharePoint server publishing infrastructure feature

Thus, in this blog we have learned the below with respect to activating the SharePoint Server Publishing Infrastructure feature in SharePoint Online:

  • What is the publishing feature in SharePoint?
  • What is the SharePoint server publishing infrastructure feature?
  • How to activate publishing features using PowerShell in SharePoint Online?
  • Does the SharePoint server publishing infrastructure feature allow in the SharePoint Online communication site?
  • SharePoint server publishing infrastructure vs SharePoint server publishing.
  • How to activate the SharePoint server publishing infrastructure feature in SharePoint Online using the PnP PowerShell?

See Also: SharePoint Online Tutorial

You may also like the following SharePoint tutorials:

Download SharePoint Online PDF Book

Download SharePoint Online & Office 365 Administration eBook

Buy the premium version of SharePoint Online & Office 365 administration eBook from here:



Buy SharePoint Online & Office 365 Administration eBook


 

Get the free demo PDF eBook from here:

FREE DOWNLOAD

Send download link to:

Subscribe to get exclusive content and recommendations every month. You can unsubscribe anytime.

About Post Author

Do you have a better solution or question on this topic? Please leave a comment