Get-PnPWikiPageContent error

%3CLINGO-SUB%20id%3D%22lingo-sub-36130%22%20slang%3D%22en-US%22%3EGet-PnPWikiPageContent%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36130%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20execute%20the%20following%20I%20get%20an%20error%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EConnect-PnPOnline%20-Url%20https%3A%2F%2F%26lt%3Btenant%26gt%3B.sharepoint.com%2Fsites%2Fentwiki%20-Credentials%20(Get-Credential)%0A%0A%24p%20%3D%20Get-PnPWikiPageContent%20-ServerRelativePageUrl%20'%2Fsites%2Fentwiki%2FPages%2Fhome.aspx'%3C%2FPRE%3E%3CP%3EError%3A%3C%2FP%3E%3CPRE%3EGet-PnPWikiPageContent%20%3A%20The%20property%20or%20field%20has%20not%20been%20initialized.%20It%20has%20not%20been%20requested%20or%20the%20request%20has%20not%20been%20executed.%20It%20%0Amay%20need%20to%20be%20explicitly%20requested.%0AAt%20line%3A1%20char%3A6%0A%2B%20%24p%20%3D%20Get-PnPWikiPageContent%20-ServerRelativePageUrl%20'%2Fsites%2Fentwiki%2FPa%20...%0A%2B%20%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20WriteError%3A%20(%3A)%20%5BGet-PnPWikiPageContent%5D%2C%20PropertyOrFieldNotInitializedException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20EXCEPTION%2CSharePointPnP.PowerShell.Commands.Publishing.GetWikiPageContent%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20following%20works%2C%20this%20confirms%20the%20file%20is%20available%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%24f%20%3D%20Get-PnPFile%20-ServerRelativeUrl%20'%2Fsites%2Fentwiki%2FPages%2Fhome.aspx'%20-AsListItem%3C%2FPRE%3E%3CP%3EAm%20I%20doing%20something%20wrong%2C%20or%20is%20this%20a%20bug%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E
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