[BUG] Set-PnPView -Aggrations: Count # is not displayed after activating an aggregation
Reporting an Issue or Missing Feature
trying to activate "count" aggregations on SharePoint Lists and Libraries is not working properly.
Expected behavior
The count of items should be displayed in the UI after activating it.
Actual behavior
Only the "Count" placeholder is visible without the actual number of items
Steps to reproduce behavior
Set-PnPView -List "Site Pages" -Identity "All Pages" -Aggregations "<FieldRef Name='LinkFilename' Type='COUNT'/>"
Additional Info:
With Export-PNPListToSiteTemplate i can see the missing part in the list schema
Activate aggregation in UI:
<Aggregations Value="On"> <FieldRef Name="LinkFilename" Type="COUNT" /> </Aggregations>
Activate aggregation with PnP Powershell:
<Aggregations Value="Off"> <FieldRef Name="LinkFilename" Type="COUNT" /> </Aggregations>
As you can see the "Value" property of the Aggregations is still set to "Off" after activation - this might be the root cause.
What is the version of the Cmdlet module you are running?
2.99.41
Which operating system/environment are you running PnP PowerShell on?
- [X ] Windows
- [ ] Linux
- [ ] MacOS
- [ ] Azure Cloud Shell
- [ ] Azure Functions
- [ ] Other : please specify
Workaround: instead of using Set-PnPView it is possible to activate count in views with the following workaround:
$view = Get-PnPView -List "SitePages" -Identity "All Pages" -Includes Aggregations,AggregationsStatus
$view.Aggregations = '<FieldRef Name="LinkFilename" Type="COUNT" />'
$view.AggregationsStatus = 'On'
$view.Update()
Invoke-PnPQuery
With this script we can set the missing AggregationStatus to "On" manually.
I opened a PR to fix this issue
hey @till-llit , this issue has been fixed and will be available in tomorrow's nightly builds. Thanks for raising the issue, much appreciated !