format-default : The collection has not been initialized...

Senior Member

Hi Guys


Quick question. I am trying to run a piece of PowerShell which is using the Add-PnPView command, in order to create a simple SharePoint view that is filtered. However, if I try and execute the PowerShell, I get this error;


format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.


I can prefix the command with a variable (i.e. $newview = add-pnpview) as per internet findings and it seems to work ok, and it mostly does work - the filter appears in the views settings. However, the filter doesn't actually work, until I resave the view via the SharePoint interface. Has anybody seen this before? Hopefully that makes sense!

0 Replies