Get-PnPWikiPageContent error

Highlighted
Contributor

Hi

 

When I execute the following I get an error:

 

Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/entwiki -Credentials (Get-Credential)

$p = Get-PnPWikiPageContent -ServerRelativePageUrl '/sites/entwiki/Pages/home.aspx'

Error:

Get-PnPWikiPageContent : The property or field has not been initialized. It has not been requested or the request has not been executed. It 
may need to be explicitly requested.
At line:1 char:6
+ $p = Get-PnPWikiPageContent -ServerRelativePageUrl '/sites/entwiki/Pa ...
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Get-PnPWikiPageContent], PropertyOrFieldNotInitializedException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Publishing.GetWikiPageContent

 

The following works, this confirms the file is available:

 

$f = Get-PnPFile -ServerRelativeUrl '/sites/entwiki/Pages/home.aspx' -AsListItem

Am I doing something wrong, or is this a bug?

 

Thanks.

0 Replies