Forum Discussion
Nigel Price
Sep 29, 2017Iron Contributor
How do I know if a page is in modern UI mode using PnPPowerShell ?
I need to audit a site and one of my tasks is to ensure that all pages are in Modern UI mode, the other thing I need to know is what Client Side Web Parts are deployed to each page.
I want to use the PnP PowerShell commands (or even just PowerShell CSOM commands)
Thanks
Nigel
- Mahendran DBrass Contributor
Get-PnPClientSidePage throws error if you are trying to find details of OOTB pages (or pages created in browser).
It works on custom pages created using pnp cmdlets.
Here is the issue opened in Github.
Have you tried using Get-PnPClientSidePage?
- Nigel PriceIron Contributor
Hi Pieter
What is the diffeence between get-PnPWebPart and Get-PnPClientSidePAge ?
I get "object reference not set to an instant of an object" when I use Get-PnPClientSidePage.
I get nothing when I use Get-PnPWebPart
The page was created in the root site and is has the modern UI.
Regards
Nigel
You should get something like this:
Get-PnPClientSidePage home.aspx PageTitle : Sections : {OfficeDevPnP.Core.Pages.CanvasSection} Controls : {7f718435-ee4d-431c-bdbf-9c4ff326f46e, a5df8fdf-b508-4b66-98a6-d83bc2597f63, df611e7c-5498-4843-a936-14e8ec332dcd, eb95c819-ab8f-4689-bd03-0c2d65d47b1f} LayoutType : Home KeepDefaultWebParts : False Context : OfficeDevPnP.Core.PnPClientContext PagesLibrary : SitePages PageListItem : Microsoft.SharePoint.Client.ListItem DefaultSection : OfficeDevPnP.Core.Pages.CanvasSection CommentsDisabled : False
if you had a traditional page you would get:
Get-PnPClientSidePage : Page 'home.aspx' does not exist