Sep 29 2017 04:00 AM
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
Sep 29 2017 04:07 AM
Have you tried using Get-PnPClientSidePage?
Sep 29 2017 06:29 AM
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
Sep 29 2017 06:35 AM - edited Sep 29 2017 06:42 AM
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
Sep 29 2017 07:39 AM - edited Sep 29 2017 07:41 AM
I have tried this and I get the errors in the attached file.
Sep 29 2017 07:56 AM
Hi @Nigel Price,
You don't need to add the double quotes to the file names. So either:
Get-PnPClientSidePage A-Modern-Page.aspx
or
if you prefer to enter it on the Identity prompt then also no quotes.
Sep 29 2017 07:57 AM
Ah I wonder mayb e the - in the file name?
Can you try it with the default home.aspx file?
Sep 29 2017 07:58 AM
Hi Pieter
I tried that and I still get the "Object Reference not set to an instance of an Object"
Regards
Nigel
Sep 29 2017 08:01 AM
Can you add to your scripts the $web like below:
$web = Get-PnPWeb Write-Host $web.Url Get-PnPClientPageSidePage -Web $web -Identity home.aspx
Sep 29 2017 08:17 AM
Just another thought, you could try Get-PnPProvisioingTemplate -Out temp.xml
Then you should find the page in there and check if you can find the modern web parts there.
Oct 03 2017 04:03 AM
Hi Pieter
I thought a provisioning template only had the home page in it ?
Regards
Nigel
Oct 03 2017 11:20 AM
Jan 10 2020 11:18 AM
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.