-
Notifications
You must be signed in to change notification settings - Fork 383
Description
Reporting an Issue or Missing Feature
When using the -EnableModernAudienceTargeting switch to enable modern audience targeting on a library, the configuration changes appear to be correct (e.g. new fields added), but when trying to set an audience on a new or existing item, I consistently receive this error: Invalid field name. {b1d24626-4fc1-403a-925f-9d2225c421de} /sites/xyz/_catalogs/users. My testing has been on the Site Pages library in communication sites.
I have tried this multiple times in two different tenants and with different versions of PnP.PowerShell, and I always get the same behavior. When using the GUI to turn audience targeting off and then back on, the problem goes away.
I have compared list settings with it working (using the GUI) and not-working (using PnP), and I can't find a difference. This includes all the list settings, all field settings including SchemaXml and EventReceivers. The resulting configuration matches what I see in the ListExtension.cs source code. There seems to be something else that the GUI is doing, but I can't pinpoint what it is.
Also interesting is if I turn audience targeting on by using the GUI, then turn it off using the GUI, and then turn it on again using PnP, it still works. Thus, the problem really is when turning it on using PnP when it has not already been turned on by the GUI.
Expected behavior
When using the PnP cmdlet to enable audience targeting, I expect it to work the same as if I used the GUI.
Actual behavior
Described above.
Steps to reproduce behavior
- Create a new communication site.
- Use Connect-PnPOnline to connect to new site.
- Set-PnPlist -Identity "Site Pages" -EnableModernAudienceTargeting $true
- Create a new page and try to set the Audience to a valid group.
Note: I get the same error if I try to set the Audience from the Properties or Details panel on an existing page.
See attached document Audience Targeting errors.docx for screenshots, including an animation of the error I receive. In that, I also provide the details for the request/response HTTP 500 errors the browser receives when trying to save.
What is the version of the Cmdlet module you are running?
v2.2.0 and v2.3.0
Which operating system/environment are you running PnP PowerShell on?
- [ X ] Windows
- Linux
- MacOS
- Azure Cloud Shell
- Azure Functions
- Other : please specify