How to identify the page is a classic or modern using PowerShell? Use SharePoint Online


Modern site pages, at the moment are identifiable by 2 content types.

1) Site pages - Content Type Id - 0x0101009D1CB255DA76424F860D91F20E6C4118

2) Repost Page - Content Type Id - 0x0101009D1CB255DA76424F860D91F20E6C4118002A50BFCFB7614729B56886FADA02339B

Using this information, we can filter pages which are modern site pages using PnP PowerShell as below:

$cred = Get-Credential  

Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/test -Credential $cred  

Get-PnPListItem -List "Site Pages" -Query "<View><Query><Where><BeginsWith><FieldRef Name='ContentTypeId'/><Value Type='ContentTypeId'>0x0101009D1CB255DA76424F860D91F20E6C4118</Value></BeginsWith></Where></Query></View>"  
| improve this answer | |

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.