-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling modern audience targeting from Set-PnPList does not function correctly #3783
Comments
After doing some additional testing, I've found that turning on audience targeting from the GUI on different library will also fix the the problem within Site Pages. Thus, it appears to be a site/web level setting, rather than the list. I've compared all the features, property bags and a few other site/web-level setting and can't find anything. If someone has a SharePoint Server SE install on hand, it may help to use .NET Reflector to see what the code is doing when the checkbox is enabled. |
We can confirm the same issues as @hawaiianmetal We are running PnP PowerShell 2.4.0. Anyone have any updates regarding this issue? |
Hi all, We have the same issue in our tenants. If we use PnP Powershell to enable audience targeting in the list Set-PnPList -Identity "ListNmae" -EnableModernAudienceTargeting $true these 2 fields are being created (We can see this in editing the list view):
If we try to add an item with a value in the Audience field (this is the name of the field in the Details form: $Resources:spcore,AudienceUserField_DisplayName;) we can the same error described here: Error: Invalid field name. {b1d24626-4fc1-403a-925f-9d2225c421de} /sites/fresh-intranet/_catalogs/users We can see the same behaviour applying a PnP Template (schema 2022/09) EnableAudienceTargeting="true" in pnp:ListInstance Any idea what this could be happening? Many thanks |
I think when you use the GUI, it turns on the Modern Audience Targeting site feature for you and then it starts working. Try Enable-PnPFeature -Scope Site -Identity bc13eaf7-67c7-4f85-a80f-a4b0dae5e5bd first. (pnp/PnP-PowerShell#2876) |
@erkanch You are a legend. |
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
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?
The text was updated successfully, but these errors were encountered: