1

I'm having an issue with creating a view on SP Online for a list to show all items inside folders. I can create the view with the filtering, but the option for the folders is not working.

$viewQuery = "<Where><Contains><FieldRef Name='Field_x0020_Name'/><Value Type='Text'>P180</Value></Contains></Where><QueryOptions><ViewAttributes Scope='RecursiveAll'/></QueryOptions>"

Add-PnPView -list $ListName -Title "View1" -Fields @("Name","Published Date") -Query $viewQuery

I can't seem to find any good examples of Add-PNPView with a query to do what I want. Any help is greatly appreciated.

1

The problem is that CAML schema of the View does not support tag <QueryOptions>. This option is set as attribute in XML view element, like <View Scope="Recursive" ....>. On the other hand, command Add-PnPView requires to specify the query part of the view only .

Fortunately, you can set this option using the command Set-PnPView. Example:

Set-PnpView -List $listName -Identity $viewName -Values @{Scope=[Microsoft.SharePoint.Client.ViewScope]::Recursive}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.