You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered:
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.
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
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: