Monthly Archives: February 2018

Enable content types in a library or in Site Pages with PowerShell

PowerShell to enable content types in a list. I had an issue where "Site page" content type had dissapeared from some older sites and the content types couldn't be changed as this setting was turned off. If you didn't know, you can't turn on content types in the advanced menu of a site pages library, you have to run a script. 


Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Import-Module 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll'

$url = "SITE"
$username =  "EMAIL"
$password = ConvertTo-SecureString "PASSWORD" -AsPlainText -Force
$SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)

$context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$context.Credentials = $SPOcredentials
$web = $context.Web


$lists = $web.lists
$list = $lists.GetByTitle("Site Pages") #change list if required


Write-Host all good 


New Site Page option missing from new drop down in Site Pages library

I had an issue where I could no longer create site pages in my site pages library, the option wasn't there although the content type was in the library.

The cause was an admin setting "Allow users to create site pages" which we had turned off when reviewing what users should be allowed to do in Office 365 and SharePoint. 

To fix:

  • Go to Admin
  • SharePoint admin
  • Settings
  • Ensure "Allow users to create site pages" is checked
  • Restart your browser and re-login
  • Option should now be available