Hi
trying to get a filtered view in a modern teams site template to the default documents lib
before I could just create a template (get-pnpProvisioningTemplate) , then apply that to the new site, but now it complains that documents already exist. before it just added the new fields and views on top of it.
so now I removed the documents lib from the xml template and try to recreate the fields and views after the site creation and before applying the xml template
but, when I try to add the view, it is created but the filter does something funky:
used code:
# Add Columns to Documents Library
Add-PnPField -List "Documents" -DisplayName "Show In Home" -InternalName "Show In Home" -Type boolean -AddToDefaultView
# Add View to Documents Library
Add-PnPView -Fields "DocIcon","LinkFilename","Modified","Editor","_UIVersionString","FileSizeDisplay" -List "Documents" -Title "Show In Home" -Query "<OrderBy><FieldRef Name='Prio' Ascending='false' /></OrderBy><Where><Eq><FieldRef Name = 'Show In Home' /><Value Type = 'Boolean'>1</Value></Eq></Where>" | out-Null
(I added the out-Null because the runbook tried to run three times otherwise)
The view gets created but the filter where "Show in home" is equal to '1' is not working
the field is None instead of 'Show In Home' and also it does not understand '1', it needs to be Yes before I can save the view in SPO
I tried using 'Yes' in de CAML but that does not take
any ideas?
also if someone could show me how I could type the add-pnpview in several lines so its not that long would be nice too :)
here is the screenshot how it looks in SPO when the powershell ran: