Provisioned News web part is not filtering correctly base on the configured page property filter #2320
Comments
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible. |
As another example, I've created a simple script that uses the Add-PnPClientSideWebPart Commandlet. The JSON for the $newsReel was created by adding the News web part to the home page and configuring it to filter based on "Featured". By adding through the UI, the filter works as expected every time I then used Export-ClientSidePage to get the CanvasContent and cleaned up the escaped JSON. After running the script below to add the web part it does not filter correctly except upon going into Edit Mode and after first Publish. Subsequent revisits to the page have the wrong filter (or really no filter) applied. ` $newsReelProperties = @" Add-PnPClientSideWebPart -Page "Home" -DefaultWebPartType NewsReel -Section 1 -Column 1 -WebPartProperties $newsReelProperties |
Finally figured out the cause of my anguish and wanted to share. I do think that eventually a code change may need to be made in PnP so leaving this open but right now I think something may need to change in a REST API first. Below is what I've observed and learned. The net seems to be that when using PnP to add the News web part a Newsreel with the wrong id is added. I affectionately have called this one the "old news". Old news likely doesn't support emphasis, which is why is has a white background instead of letting the section background through. New news however does allow the emphasis to shine through.
Short term my fix is the following PowerShell Code:
Long term hopefully the API returns the right ID that can be used in PnP provisioning code. |
Category
[ X ] Bug
[ ] Enhancement
Environment
[ X ] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013
If SharePoint on-premises, what's exact CU version:
Expected or Desired Behavior
Provisioning a ClientSidePage configured with a News Web part that contains configured Page Property filter should filter based on that filter.
Observed Behavior
If the News Web part is the first News web part provisioned on the page it does not filter and requires it to be manually removed and then re-added.
If the News Web part is NOT the first News web part provisioned on the page it does appear to filter correctly but only until the first web part is removed. Then it filters incorrectly (or not at all)
Both of these "Featured Brand News" web parts have the EXACT same JsonControlData except instanceId. When provisioned they show different results, when using Export-PnPClientSidePage the output the exact same output.
Steps to Reproduce
Other Notes
I have been using TestMethods in ClientSidePagesTests.cs and trying various updates to ObjectClientSidePages.cs to see if I can figure out a way to fix this but so far have come up short. The JsonControlData that is being set on myWebPart.PropertiesJson looks correct (based on what was exported).
Please let me know if there is any additional information you need from me. I'll keep digging on my end.
The text was updated successfully, but these errors were encountered: