powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Set-PnPList ModernAudienceTargeting doesn't work as intended

Open Drenam1 opened this issue 8 months ago • 0 comments

Reporting an Issue or Missing Feature

When I try to programmatically set the Modern Audience Targeting feature to On on a list, the feature is turned on but does not function as intended. When I add an audience to an item, that audience isn't retained on the item.

Expected behavior

When adding an audience to an item on a list that has had Modern Audience Targeting enabled programmatically, that audience is saved and kept properly.

Actual behavior

Any audience added to an item on a list that has had Modern Audience Targeting enabled programmatically is not displayed upon future viewings of the item.

Steps to reproduce behavior

I've tried this a couple of ways - with Set-PnPList and by deploying the list via a PnP Template with EnableAudienceTargeting='true' Set-PnPList

  1. Connect to the relevant site using Connect-PnPOnline
  2. Run Enable-PnPFeature -Scope Site -Identity bc13eaf7-67c7-4f85-a80f-a4b0dae5e5bd as per the documentation (I have attempted this both with this feature enabled and without it enabled, with no change in outcome)
  3. Run Set-PnPList -Identity "ListName" -EnableModernAudienceTargeting $true

XML File

  1. Generate a PnP Template XML that will create a list.
  2. Ensure that the list in the PnP Template XML has EnableAudienceTargeting='true'
  3. Invoke the PnP template XML on a site.

What is the version of the Cmdlet module you are running?

Tried on v2.1.1 and v3.1.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows

Drenam1 avatar Jul 21 '25 09:07 Drenam1